rpc: Avoid getchaintxstats invalid results

This commit is contained in:
MarcoFalke
2024-03-25 11:33:07 +01:00
parent 0bd2bd1efb
commit fa2dada0c9
3 changed files with 23 additions and 13 deletions

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)

View File

@@ -51,7 +51,6 @@ unsigned-integer-overflow:CCoinsViewCache::Uncache
unsigned-integer-overflow:CompressAmount
unsigned-integer-overflow:DecompressAmount
unsigned-integer-overflow:crypto/
unsigned-integer-overflow:getchaintxstats*
unsigned-integer-overflow:MurmurHash3
unsigned-integer-overflow:CBlockPolicyEstimator::processBlockTx
unsigned-integer-overflow:TxConfirmStats::EstimateMedianVal
@@ -63,7 +62,6 @@ implicit-integer-sign-change:CBlockPolicyEstimator::processBlockTx
implicit-integer-sign-change:SetStdinEcho
implicit-integer-sign-change:compressor.h
implicit-integer-sign-change:crypto/
implicit-integer-sign-change:getchaintxstats*
implicit-integer-sign-change:TxConfirmStats::removeTx
implicit-integer-sign-change:prevector.h
implicit-integer-sign-change:verify_flags