Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/wallet/feebumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
errors.emplace_back(Untranslated(strprintf("%s:%u is already spent", txin.prevout.hash.GetHex(), txin.prevout.n)));
return Result::MISC_ERROR;
}
// ELEMENTS: the input value is summed below, which needs explicit amounts.
if (!coin.out.nValue.IsExplicit() || !coin.out.nAsset.IsExplicit()) {
errors.push_back(Untranslated("bumpfee can only be called on an unblinded transaction"));
return Result::WALLET_ERROR;
}
PreselectedInput& preset_txin = new_coin_control.Select(txin.prevout);
if (!wallet.IsMine(txin.prevout)) {
preset_txin.SetTxOut(coin.out);
Expand Down
2 changes: 2 additions & 0 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
'wallet_elements_regression_1259.py --legacy-wallet',
'wallet_elements_21million.py --legacy-wallet',
'wallet_elements_dust_relay.py --legacy-wallet',
'wallet_elements_bumpfee_blinded.py --legacy-wallet',
'wallet_elements_bumpfee_blinded.py --descriptors',
# Longest test should go first, to favor running tests in parallel
# vv Tests less than 5m vv
'feature_taproot.py',
Expand Down
57 changes: 57 additions & 0 deletions test/functional/wallet_elements_bumpfee_blinded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
# Copyright (c) 2026 The Elements Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bumpfee and psbtbumpfee on a wallet transaction that spends a blinded (confidential) coin.

The fee bumper summed the input amounts with GetAmount(), which asserts that the amount is explicit,
so bumping such a transaction aborted the node. It must fail with an RPC error instead, as it already
does for a transaction with blinded outputs.
"""

from decimal import Decimal

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_raises_rpc_error

UNBLINDED_ONLY = "bumpfee can only be called on an unblinded transaction"


class BumpFeeBlindedInputTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.extra_args = [["-blindedaddresses=1"]]

def add_options(self, parser):
self.add_wallet_options(parser)

def skip_test_if_missing_module(self):
self.skip_if_no_wallet()

def run_test(self):
node = self.nodes[0]

self.log.info("Create a blinded coin")
node.sendtoaddress(node.getnewaddress(), 5)
self.generate(node, 1)
coin = next(u for u in node.listunspent() if "amountcommitment" in u)

self.log.info("Spend it in a replaceable transaction")
fee = Decimal("0.0001")
raw = node.createrawtransaction([{"txid": coin["txid"], "vout": coin["vout"]}],
[{node.getnewaddress(): coin["amount"] - fee}, {"fee": fee}],
0, True)
signed = node.signrawtransactionwithwallet(node.blindrawtransaction(raw))
assert signed["complete"]
txid = node.sendrawtransaction(signed["hex"])

self.log.info("bumpfee and psbtbumpfee fail with an RPC error and the node keeps running")
assert_raises_rpc_error(-4, UNBLINDED_ONLY, node.bumpfee, txid)
assert_raises_rpc_error(-4, UNBLINDED_ONLY, node.psbtbumpfee, txid)
explicit_output = {node.getaddressinfo(node.getnewaddress())["unconfidential"]: coin["amount"] - 2 * fee}
assert_raises_rpc_error(-4, UNBLINDED_ONLY, node.bumpfee, txid, {"outputs": [explicit_output]})
assert txid in node.getrawmempool()


if __name__ == '__main__':
BumpFeeBlindedInputTest(__file__).main()