Merge bitcoin/bitcoin#35404: wallet: allow anti-fee-sniping in sendall RPC while not relying on RBF default

9c1fcaca5c wallet, test: fix sendall anti-fee-sniping when locktime is not specified (rkrux)
8877eec726 wallet: allow anti-fee-sniping in sendall RPC while not relying on RBF default (rkrux)

Pull request description:

  Partially fixes https://github.com/bitcoin/bitcoin/issues/32661.
  Prerequisite to #35405.

  The test change in the second commit would fail without the presence
  of the first commit.

ACKs for top commit:
  maflcko:
    review ACK 9c1fcaca5c 🍅
  xyzconstant:
    Tested ACK 9c1fcaca5c
  polespinasa:
    code review ACK 9c1fcaca5c
  sedited:
    ACK 9c1fcaca5c

Tree-SHA512: 048c1a6c64c104f8c27053e4dea139fb8740f30096f4d85daf23aa53a9ad21f0120151a7d1d6ea19b12d174976999335b3f9ac863800629774d8030b7f34918f
This commit is contained in:
merge-script
2026-06-02 11:59:27 +02:00
2 changed files with 4 additions and 4 deletions

View File

@@ -1498,7 +1498,7 @@ RPCMethod sendall()
if (output.depth == 0 && coin_control.m_version == TRUC_VERSION) { if (output.depth == 0 && coin_control.m_version == TRUC_VERSION) {
coin_control.m_max_tx_weight = TRUC_CHILD_MAX_WEIGHT; 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); rawTx.vin.push_back(input);
total_input_value += output.txout.nValue; total_input_value += output.txout.nValue;
} }

View File

@@ -59,8 +59,8 @@ class SendallTest(BitcoinTestFramework):
return self.wallet.getbalances()["mine"]["trusted"] return self.wallet.getbalances()["mine"]["trusted"]
# Helper schema for success cases # Helper schema for success cases
def test_sendall_success(self, sendall_args, remaining_balance = 0): def test_sendall_success(self, sendall_args, remaining_balance = 0, *, options=None):
sendall_tx_receipt = self.wallet.sendall(sendall_args) sendall_tx_receipt = self.wallet.sendall(sendall_args, options=options)
self.generate(self.nodes[0], 1) self.generate(self.nodes[0], 1)
# wallet has remaining balance (usually empty) # wallet has remaining balance (usually empty)
assert_equal(remaining_balance, self.wallet.getbalances()["mine"]["trusted"]) assert_equal(remaining_balance, self.wallet.getbalances()["mine"]["trusted"])
@@ -436,7 +436,7 @@ class SendallTest(BitcoinTestFramework):
def sendall_anti_fee_sniping(self): def sendall_anti_fee_sniping(self):
self.log.info("Testing sendall does anti-fee-sniping when locktime is not specified") self.log.info("Testing sendall does anti-fee-sniping when locktime is not specified")
self.add_utxos([10,11]) 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 # the locktime should be within 100 blocks of the
# block height # block height