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
@@ -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