mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #5256
4b21d38d
blockchain: speed up getting N blocks weights/long term weights (moneromooo-monero)
This commit is contained in:
commit
5ac46c5310
8 changed files with 142 additions and 15 deletions
|
@ -64,6 +64,18 @@ public:
|
|||
virtual uint64_t height() const override { return blocks.size(); }
|
||||
virtual size_t get_block_weight(const uint64_t &h) const override { return blocks[h].weight; }
|
||||
virtual uint64_t get_block_long_term_weight(const uint64_t &h) const override { return blocks[h].long_term_weight; }
|
||||
virtual std::vector<uint64_t> get_block_weights(uint64_t start_height, size_t count) const override {
|
||||
std::vector<uint64_t> ret;
|
||||
ret.reserve(count);
|
||||
while (count-- && start_height < blocks.size()) ret.push_back(blocks[start_height++].weight);
|
||||
return ret;
|
||||
}
|
||||
virtual std::vector<uint64_t> get_long_term_block_weights(uint64_t start_height, size_t count) const override {
|
||||
std::vector<uint64_t> ret;
|
||||
ret.reserve(count);
|
||||
while (count-- && start_height < blocks.size()) ret.push_back(blocks[start_height++].long_term_weight);
|
||||
return ret;
|
||||
}
|
||||
virtual crypto::hash top_block_hash(uint64_t *block_height = NULL) const override {
|
||||
uint64_t h = height();
|
||||
crypto::hash top = crypto::null_hash;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue