mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 18:22:57 +02:00
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:
@@ -58,7 +58,7 @@ class GetBlockFromPeerTest(BitcoinTestFramework):
|
||||
self.log.info("Node 0 should only have the header for node 1's block 3")
|
||||
x = next(filter(lambda x: x['hash'] == short_tip, self.nodes[0].getchaintips()))
|
||||
assert_equal(x['status'], "headers-only")
|
||||
assert_raises_rpc_error(-1, "Block not found on disk", self.nodes[0].getblock, short_tip)
|
||||
assert_raises_rpc_error(-1, "Block not available (not fully downloaded)", self.nodes[0].getblock, short_tip)
|
||||
|
||||
self.log.info("Fetch block from node 1")
|
||||
peers = self.nodes[0].getpeerinfo()
|
||||
|
||||
Reference in New Issue
Block a user