mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Merge #9673: Set correct metadata on bumpfee wallet transactions
4ec057d
[wallet] Set correct metadata on bumpfee wallet transactions (Russell Yanofsky)
This commit is contained in:
commit
8d6447ecf7
@ -69,6 +69,7 @@ class BumpFeeTest(BitcoinTestFramework):
|
|||||||
test_rebumping(rbf_node, dest_address)
|
test_rebumping(rbf_node, dest_address)
|
||||||
test_rebumping_not_replaceable(rbf_node, dest_address)
|
test_rebumping_not_replaceable(rbf_node, dest_address)
|
||||||
test_unconfirmed_not_spendable(rbf_node, rbf_node_address)
|
test_unconfirmed_not_spendable(rbf_node, rbf_node_address)
|
||||||
|
test_bumpfee_metadata(rbf_node, dest_address)
|
||||||
test_locked_wallet_fails(rbf_node, dest_address)
|
test_locked_wallet_fails(rbf_node, dest_address)
|
||||||
print("Success")
|
print("Success")
|
||||||
|
|
||||||
@ -257,6 +258,14 @@ def test_unconfirmed_not_spendable(rbf_node, rbf_node_address):
|
|||||||
if t["txid"] == rbfid and t["address"] == rbf_node_address and t["spendable"]), 1)
|
if t["txid"] == rbfid and t["address"] == rbf_node_address and t["spendable"]), 1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_bumpfee_metadata(rbf_node, dest_address):
|
||||||
|
rbfid = rbf_node.sendtoaddress(dest_address, 0.00090000, "comment value", "to value")
|
||||||
|
bumped_tx = rbf_node.bumpfee(rbfid)
|
||||||
|
bumped_wtx = rbf_node.gettransaction(bumped_tx["txid"])
|
||||||
|
assert_equal(bumped_wtx["comment"], "comment value")
|
||||||
|
assert_equal(bumped_wtx["to"], "to value")
|
||||||
|
|
||||||
|
|
||||||
def test_locked_wallet_fails(rbf_node, dest_address):
|
def test_locked_wallet_fails(rbf_node, dest_address):
|
||||||
rbfid = create_fund_sign_send(rbf_node, {dest_address: 0.00090000})
|
rbfid = create_fund_sign_send(rbf_node, {dest_address: 0.00090000})
|
||||||
rbf_node.walletlock()
|
rbf_node.walletlock()
|
||||||
|
@ -2944,7 +2944,12 @@ UniValue bumpfee(const JSONRPCRequest& request)
|
|||||||
// commit/broadcast the tx
|
// commit/broadcast the tx
|
||||||
CReserveKey reservekey(pwalletMain);
|
CReserveKey reservekey(pwalletMain);
|
||||||
CWalletTx wtxBumped(pwalletMain, MakeTransactionRef(std::move(tx)));
|
CWalletTx wtxBumped(pwalletMain, MakeTransactionRef(std::move(tx)));
|
||||||
|
wtxBumped.mapValue = wtx.mapValue;
|
||||||
wtxBumped.mapValue["replaces_txid"] = hash.ToString();
|
wtxBumped.mapValue["replaces_txid"] = hash.ToString();
|
||||||
|
wtxBumped.vOrderForm = wtx.vOrderForm;
|
||||||
|
wtxBumped.strFromAccount = wtx.strFromAccount;
|
||||||
|
wtxBumped.fTimeReceivedIsTxTime = true;
|
||||||
|
wtxBumped.fFromMe = true;
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
if (!pwalletMain->CommitTransaction(wtxBumped, reservekey, g_connman.get(), state)) {
|
if (!pwalletMain->CommitTransaction(wtxBumped, reservekey, g_connman.get(), state)) {
|
||||||
// NOTE: CommitTransaction never returns false, so this should never happen.
|
// NOTE: CommitTransaction never returns false, so this should never happen.
|
||||||
|
Loading…
Reference in New Issue
Block a user