mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 01:09:14 +01:00
Merge bitcoin/bitcoin#26780: rpc: simplify scan blocks
b922f6b526rpc: scanblocks, add "completed" flag to the result obj (furszy)ce50acc54frpc: scanblocks, do not traverse the whole chain block by block (furszy) Pull request description: Coming from https://github.com/bitcoin/bitcoin/pull/23549#pullrequestreview-1105712566 The current `scanblocks` flow walks-through every block in the active chain until hits the chain tip or processes 10k blocks, then calls `lookupFilterRange` function to obtain all filters from that particular range. This is only done to obtain the heights range to look up the block filters. Which is unneeded. As `scanblocks` only lookup block filters in the active chain, we can directly calculate the lookup range heights, by using the chain tip, without requiring to traverse the chain block by block. ACKs for top commit: achow101: ACKb922f6b526TheCharlatan: ACKb922f6b526Tree-SHA512: 0587e6d9cf87a59184adb2dbc26a4e2bce3a16233594c6c330f69feb49bf7dc63fdacf44fc20308e93441159ebc604c63eb7de19204d3e745a2ff16004892b45
This commit is contained in:
@@ -49,6 +49,7 @@ class ScanblocksTest(BitcoinTestFramework):
|
||||
assert blockhash in out['relevant_blocks']
|
||||
assert_equal(height, out['to_height'])
|
||||
assert_equal(0, out['from_height'])
|
||||
assert_equal(True, out['completed'])
|
||||
|
||||
# mine another block
|
||||
blockhash_new = self.generate(node, 1)[0]
|
||||
|
||||
Reference in New Issue
Block a user