What changed, and why it matters
This is a test-only change in Bitcoin Core. It clarifies comments and strengthens a functional test for Replace-By-Fee (RBF) behavior when the incremental relay feerate is set to zero. No production code, consensus rules, or network behavior were modified.
No security action needed. This is a routine test improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies test/functional/feature_rbf.py. It removes an unused import, adds explanatory comments about why different transaction versions and target vsizes are used, and adds a branch to verify that when incremental relay feerate is zero, a replacement still requires a higher absolute fee rate (so a smaller transaction at the same absolute fee succeeds, while an identically-sized one fails). This is purely a test hardening and documentation change.
Changed components
test/functional/feature_rbf.pyInspect captured patch +14 / −11
diff --git a/test/functional/feature_rbf.py b/test/functional/feature_rbf.py
index 86fe2f5b..6922b5e0 100755
--- a/test/functional/feature_rbf.py
+++ b/test/functional/feature_rbf.py
@@ -13,7 +13,6 @@ from test_framework.messages import (
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,
get_fee,
@@ -603,23 +602,27 @@ class ReplaceByFeeTest(BitcoinTestFramework):
low_feerate = min_relay_feerate * 2
confirmed_utxo = self.wallet.get_utxo(confirmed_only=True)
- replacee_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee_rate=low_feerate, target_vsize=5000)
+ # Use different versions to avoid creating an identical transaction when failed_replacement_tx is created.
+ # Use a target vsize that is small, but something larger than the minimum so that we can create a transaction that is 1vB smaller later.
+ replacee_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee_rate=low_feerate, version=3, target_vsize=200)
node.sendrawtransaction(replacee_tx['hex'])
- replacement_placeholder_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo)
+ replacement_placeholder_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, target_vsize=200)
replacement_expected_size = replacement_placeholder_tx['tx'].get_vsize()
replacement_required_fee = get_fee(replacement_expected_size, incremental_setting_decimal) + replacee_tx['fee']
- # Should always be required to pay additional fees
- if incremental_setting > 0:
- assert_greater_than(replacement_required_fee, replacee_tx['fee'])
-
- # 1 satoshi shy of the required fee
- failed_replacement_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee=replacement_required_fee - Decimal("0.00000001"))
+ # Show that replacement fails when paying 1 satoshi shy of the required fee
+ failed_replacement_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee=replacement_required_fee - Decimal("0.00000001"), version=2, target_vsize=200)
assert_raises_rpc_error(-26, "insufficient fee", node.sendrawtransaction, failed_replacement_tx['hex'])
+ replacement_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee=replacement_required_fee, version=2, target_vsize=200)
- replacement_tx = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee=replacement_required_fee)
- node.sendrawtransaction(replacement_tx['hex'])
+ if incremental_setting == 0:
+ # When incremental relay feerate is 0, additional fees are not required, but higher feerate is still required.
+ assert_raises_rpc_error(-26, "insufficient fee", node.sendrawtransaction, replacement_tx['hex'])
+ replacement_tx_smaller = self.wallet.create_self_transfer(utxo_to_spend=confirmed_utxo, fee=replacement_required_fee, version=2, target_vsize=199)
+ node.sendrawtransaction(replacement_tx_smaller['hex'])
+ else:
+ node.sendrawtransaction(replacement_tx['hex'])
def test_fullrbf(self):
# BIP125 signaling is not respected
Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.