From 8877eec726d82ba997191fb04b824c7684e16746 Mon Sep 17 00:00:00 2001 From: rkrux Date: Thu, 28 May 2026 19:35:54 +0530 Subject: [PATCH 1/2] wallet: allow anti-fee-sniping in sendall RPC while not relying on RBF default In case locktime (and replaceable) not being specified in this RPC request, the wallet sets the transaction replaceable due to the default value of opt-in RBF set in the wallet. This allowed the anti-fee-sniping flow to be executed but in case of replaceable being set false in the request, anti-fee-sniping flow would be missed. This patch fixes it. --- src/wallet/rpc/spend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index b6cdc8600f3..8bb14c47948 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1498,7 +1498,7 @@ RPCMethod sendall() if (output.depth == 0 && coin_control.m_version == TRUC_VERSION) { coin_control.m_max_tx_weight = TRUC_CHILD_MAX_WEIGHT; } - CTxIn input(output.outpoint.hash, output.outpoint.n, CScript(), rbf ? MAX_BIP125_RBF_SEQUENCE : CTxIn::SEQUENCE_FINAL); + CTxIn input(output.outpoint.hash, output.outpoint.n, CScript(), rbf ? MAX_BIP125_RBF_SEQUENCE : CTxIn::MAX_SEQUENCE_NONFINAL); rawTx.vin.push_back(input); total_input_value += output.txout.nValue; } From 9c1fcaca5cb8481b2a46f42e0f43888311b97ef2 Mon Sep 17 00:00:00 2001 From: rkrux Date: Thu, 28 May 2026 19:41:58 +0530 Subject: [PATCH 2/2] wallet, test: fix sendall anti-fee-sniping when locktime is not specified This particular test case only needs to ensure that locktime is not specified in the RPC request, it doesn't need to rely on the wallet optin RBF default that causes the test to pass coincidentally. Co-authored-by: maflcko <6399679+maflcko@users.noreply.github.com> --- test/functional/wallet_sendall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/wallet_sendall.py b/test/functional/wallet_sendall.py index 0524b5c82ed..657cdace2d7 100755 --- a/test/functional/wallet_sendall.py +++ b/test/functional/wallet_sendall.py @@ -59,8 +59,8 @@ class SendallTest(BitcoinTestFramework): return self.wallet.getbalances()["mine"]["trusted"] # Helper schema for success cases - def test_sendall_success(self, sendall_args, remaining_balance = 0): - sendall_tx_receipt = self.wallet.sendall(sendall_args) + def test_sendall_success(self, sendall_args, remaining_balance = 0, *, options=None): + sendall_tx_receipt = self.wallet.sendall(sendall_args, options=options) self.generate(self.nodes[0], 1) # wallet has remaining balance (usually empty) assert_equal(remaining_balance, self.wallet.getbalances()["mine"]["trusted"]) @@ -436,7 +436,7 @@ class SendallTest(BitcoinTestFramework): def sendall_anti_fee_sniping(self): self.log.info("Testing sendall does anti-fee-sniping when locktime is not specified") self.add_utxos([10,11]) - tx_from_wallet = self.test_sendall_success(sendall_args = [self.remainder_target]) + tx_from_wallet = self.test_sendall_success(sendall_args = [self.remainder_target], options={"replaceable":False}) # the locktime should be within 100 blocks of the # block height