rpc: Improve getblock / getblockstats error when only header is available.
This improves the error message of the getblock and getblockstats rpc and prevents calls to ReadRawBlockFromDisk(), which are unnecessary if we know from the header nStatus field that the block is not available.
This commit is contained in:
1 parent
e5b537bbdf
commit
5290cbd585
6 files changed
+33
-25
No files matched your search
@@ -102,10 +102,10 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
||||
tip_height = pruned_node.getblockcount()
|
||||
limit_buffer = 2
|
||||
# Prevent races by waiting for the tip to arrive first
|
||||
self.wait_until(lambda: not try_rpc(-1, "Block not found", full_node.getblock, pruned_node.getbestblockhash()))
|
||||
self.wait_until(lambda: not try_rpc(-1, "Block not available (not fully downloaded)", full_node.getblock, pruned_node.getbestblockhash()))
|
||||
for height in range(start_height_full_node + 1, tip_height + 1):
|
||||
if height <= tip_height - (NODE_NETWORK_LIMITED_MIN_BLOCKS - limit_buffer):
|
||||
assert_raises_rpc_error(-1, "Block not found on disk", full_node.getblock, pruned_node.getblockhash(height))
|
||||
assert_raises_rpc_error(-1, "Block not available (not fully downloaded)", full_node.getblock, pruned_node.getblockhash(height))
|
||||
else:
|
||||
full_node.getblock(pruned_node.getblockhash(height)) # just assert it does not throw an exception
|
||||
|
||||
|
||||
Reference in new issue
Block a user