rpc: Avoid getchaintxstats invalid results

This commit is contained in:
MarcoFalke committed 2024-07-02 08:46:02 +02:00
1 parent 0bd2bd1efb
commit fa2dada0c9
3 files changed
+23 -13

No files matched your search

+3 -3
View File
@@ -301,7 +301,7 @@ class AssumeutxoTest(BitcoinTestFramework):
the snapshot, and final values after the snapshot is validated."""
for height, block in blocks.items():
tx = n1.getblockheader(block.hash)["nTx"]
chain_tx = n1.getchaintxstats(nblocks=1, blockhash=block.hash)["txcount"]
chain_tx = n1.getchaintxstats(nblocks=1, blockhash=block.hash).get("txcount", None)
# Intermediate nTx of the starting block should be set, but nTx of
# later blocks should be 0 before they are downloaded.
@@ -311,11 +311,11 @@ class AssumeutxoTest(BitcoinTestFramework):
assert_equal(tx, 0)
# Intermediate nChainTx of the starting block and snapshot block
# should be set, but others should be 0 until they are downloaded.
# should be set, but others should be None until they are downloaded.
if final or height in (START_HEIGHT, SNAPSHOT_BASE_HEIGHT):
assert_equal(chain_tx, block.chain_tx)
else:
assert_equal(chain_tx, 0)
assert_equal(chain_tx, None)
check_tx_counts(final=False)