merge bitcoin#23037: fix confusing off-by-one nValue in feature_coinstatsindex.py

This commit is contained in:
Kittywhiskers Van Gogh 2024-09-30 09:03:26 +00:00
parent 3b9f9352a1
commit 234f22a72e
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -178,7 +178,7 @@ class CoinStatsIndexTest(BitcoinTestFramework):
# Generate and send another tx with an OP_RETURN output (which is unspendable)
tx2 = CTransaction()
tx2.vin.append(CTxIn(COutPoint(int(tx1_txid, 16), n), b''))
tx2.vout.append(CTxOut(int(20.99 * COIN), CScript([OP_RETURN] + [OP_FALSE]*30)))
tx2.vout.append(CTxOut(int(Decimal('20.99') * COIN), CScript([OP_RETURN] + [OP_FALSE]*30)))
tx2_hex = self.nodes[0].signrawtransactionwithwallet(tx2.serialize().hex())['hex']
self.nodes[0].sendrawtransaction(tx2_hex)
@ -189,16 +189,16 @@ class CoinStatsIndexTest(BitcoinTestFramework):
for hash_option in index_hash_options:
# Check all amounts were registered correctly
res6 = index_node.gettxoutsetinfo(hash_option, 108)
assert_equal(res6['total_unspendable_amount'], Decimal('70.98999999'))
assert_equal(res6['total_unspendable_amount'], Decimal('70.99000000'))
assert_equal(res6['block_info'], {
'unspendable': Decimal('20.98999999'),
'unspendable': Decimal('20.99000000'),
'prevout_spent': 511,
'new_outputs_ex_coinbase': Decimal('489.99999741'),
'coinbase': Decimal('500.01000260'),
'coinbase': Decimal('500.01000259'),
'unspendables': {
'genesis_block': 0,
'bip30': 0,
'scripts': Decimal('20.98999999'),
'scripts': Decimal('20.99000000'),
'unclaimed_rewards': 0
}
})
@ -220,7 +220,7 @@ class CoinStatsIndexTest(BitcoinTestFramework):
for hash_option in index_hash_options:
res7 = index_node.gettxoutsetinfo(hash_option, 109)
assert_equal(res7['total_unspendable_amount'], Decimal('530.98999999'))
assert_equal(res7['total_unspendable_amount'], Decimal('530.99000000'))
assert_equal(res7['block_info'], {
'unspendable': 460,
'prevout_spent': 0,