Skip to content

Commit 4ec057d

Browse files
committed
[wallet] Set correct metadata on bumpfee wallet transactions
Preserve comment, order form, and account strings from the original wallet transaction. Also set fTimeReceivedIsTxTime and fFromMe fields for consistency with CWallet::CreateTransaction. The latter two fields don't influence current wallet behavior, but do record that the transaction originated in the wallet instead of coming from the network or sendrawtransaction.
1 parent 1c2edd9 commit 4ec057d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

qa/rpc-tests/bumpfee.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def run_test(self):
6969
test_rebumping(rbf_node, dest_address)
7070
test_rebumping_not_replaceable(rbf_node, dest_address)
7171
test_unconfirmed_not_spendable(rbf_node, rbf_node_address)
72+
test_bumpfee_metadata(rbf_node, dest_address)
7273
test_locked_wallet_fails(rbf_node, dest_address)
7374
print("Success")
7475

@@ -257,6 +258,14 @@ def test_unconfirmed_not_spendable(rbf_node, rbf_node_address):
257258
if t["txid"] == rbfid and t["address"] == rbf_node_address and t["spendable"]), 1)
258259

259260

261+
def test_bumpfee_metadata(rbf_node, dest_address):
262+
rbfid = rbf_node.sendtoaddress(dest_address, 0.00090000, "comment value", "to value")
263+
bumped_tx = rbf_node.bumpfee(rbfid)
264+
bumped_wtx = rbf_node.gettransaction(bumped_tx["txid"])
265+
assert_equal(bumped_wtx["comment"], "comment value")
266+
assert_equal(bumped_wtx["to"], "to value")
267+
268+
260269
def test_locked_wallet_fails(rbf_node, dest_address):
261270
rbfid = create_fund_sign_send(rbf_node, {dest_address: 0.00090000})
262271
rbf_node.walletlock()

src/wallet/rpcwallet.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,7 +2944,12 @@ UniValue bumpfee(const JSONRPCRequest& request)
29442944
// commit/broadcast the tx
29452945
CReserveKey reservekey(pwalletMain);
29462946
CWalletTx wtxBumped(pwalletMain, MakeTransactionRef(std::move(tx)));
2947+
wtxBumped.mapValue = wtx.mapValue;
29472948
wtxBumped.mapValue["replaces_txid"] = hash.ToString();
2949+
wtxBumped.vOrderForm = wtx.vOrderForm;
2950+
wtxBumped.strFromAccount = wtx.strFromAccount;
2951+
wtxBumped.fTimeReceivedIsTxTime = true;
2952+
wtxBumped.fFromMe = true;
29482953
CValidationState state;
29492954
if (!pwalletMain->CommitTransaction(wtxBumped, reservekey, g_connman.get(), state)) {
29502955
// NOTE: CommitTransaction never returns false, so this should never happen.

0 commit comments

Comments
 (0)