Merge bitcoin/bitcoin#33118: test: fix anti-fee-sniping off-by-one error

e07e2532b4 test: fix anti-fee-sniping off-by-one error (ishaanam)

Pull request description:

  This fixes the off-by-one error in the anti-fee-sniping tests for `send` and `sendall`. `assert_greater_than` fails if the two values are equal.

  Closes #33114

ACKs for top commit:
  achow101:
    ACK e07e2532b4
  glozow:
    utACK e07e2532b4

Tree-SHA512: 6c9c3d1256faf563361946703d9a51279777d73bc1a849873e03e5b5db52c3c2b9dea4bfe27b1f01b9c830ca246200a895b6a28484da6d822b93b0c7cba237c1
This commit is contained in:
merge-script
2025-08-03 11:53:28 +01:00
2 changed files with 8 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ from test_framework.util import (
assert_equal,
assert_fee_amount,
assert_greater_than,
assert_greater_than_or_equal,
assert_raises_rpc_error,
count_bytes,
)
@@ -149,7 +150,9 @@ class WalletSendTest(BitcoinTestFramework):
else:
if add_to_wallet:
decoded_tx = from_wallet.gettransaction(txid=res["txid"], verbose=True)["decoded"]
assert_greater_than(decoded_tx["locktime"], from_wallet.getblockcount() - 100)
# the locktime should be within 100 blocks of the
# block height
assert_greater_than_or_equal(decoded_tx["locktime"], from_wallet.getblockcount() - 100)
if expect_sign:
assert_equal(res["complete"], True)

View File

@@ -11,6 +11,7 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_greater_than,
assert_greater_than_or_equal,
assert_raises_rpc_error,
)
@@ -437,7 +438,9 @@ class SendallTest(BitcoinTestFramework):
self.add_utxos([10,11])
tx_from_wallet = self.test_sendall_success(sendall_args = [self.remainder_target])
assert_greater_than(tx_from_wallet["decoded"]["locktime"], tx_from_wallet["blockheight"] - 100)
# the locktime should be within 100 blocks of the
# block height
assert_greater_than_or_equal(tx_from_wallet["decoded"]["locktime"], tx_from_wallet["blockheight"] - 100)
self.log.info("Testing sendall does not do anti-fee-sniping when locktime is specified")
self.add_utxos([10,11])