From a1aaa7f51f4205ae4d27fbceb2c3a97bc114e828 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Mon, 16 May 2022 17:58:19 -0300 Subject: [PATCH 1/2] rpc, wallet: add `abandoned` field for all categories of transactions in ListTransactions --- src/wallet/rpc/transactions.cpp | 10 ++++------ test/functional/wallet_bumpfee.py | 5 +++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/wallet/rpc/transactions.cpp b/src/wallet/rpc/transactions.cpp index c257af13c4f..d2b33a8b700 100644 --- a/src/wallet/rpc/transactions.cpp +++ b/src/wallet/rpc/transactions.cpp @@ -389,6 +389,7 @@ static void ListTransactions(const CWallet& wallet, const CWalletTx& wtx, int nM entry.pushKV("label", label); } entry.pushKV("vout", r.vout); + entry.pushKV("abandoned", wtx.isAbandoned()); if (fLong) WalletTxToJSON(wallet, wtx, entry); ret.push_back(entry); @@ -462,8 +463,7 @@ RPCHelpMan listtransactions() }, TransactionDescriptionString()), { - {RPCResult::Type::BOOL, "abandoned", /*optional=*/true, "'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n" - "'send' category of transactions."}, + {RPCResult::Type::BOOL, "abandoned", "'true' if the transaction has been abandoned (inputs are respendable)."}, })}, } }, @@ -576,8 +576,7 @@ RPCHelpMan listsinceblock() }, TransactionDescriptionString()), { - {RPCResult::Type::BOOL, "abandoned", /*optional=*/true, "'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n" - "'send' category of transactions."}, + {RPCResult::Type::BOOL, "abandoned", "'true' if the transaction has been abandoned (inputs are respendable)."}, {RPCResult::Type::STR, "label", /*optional=*/true, "A comment for the address/transaction, if any"}, })}, }}, @@ -722,8 +721,7 @@ RPCHelpMan gettransaction() {RPCResult::Type::NUM, "vout", "the vout value"}, {RPCResult::Type::STR_AMOUNT, "fee", /*optional=*/true, "The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n" "'send' category of transactions."}, - {RPCResult::Type::BOOL, "abandoned", /*optional=*/true, "'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n" - "'send' category of transactions."}, + {RPCResult::Type::BOOL, "abandoned", "'true' if the transaction has been abandoned (inputs are respendable)."}, {RPCResult::Type::ARR, "parent_descs", /*optional=*/true, "Only if 'category' is 'received'. List of parent descriptors for the scriptPubKey of this coin.", { {RPCResult::Type::STR, "desc", "The descriptor string."}, }}, diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index 1cb3f434e87..f1e7869d914 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -539,6 +539,11 @@ def test_unconfirmed_not_spendable(self, rbf_node, rbf_node_address): # Call abandon to make sure the wallet doesn't attempt to resubmit # the bump tx and hope the wallet does not rebroadcast before we call. rbf_node.abandontransaction(bumpid) + + tx_bump_abandoned = rbf_node.gettransaction(bumpid) + for tx in tx_bump_abandoned['details']: + assert_equal(tx['abandoned'], True) + assert bumpid not in rbf_node.getrawmempool() assert rbfid in rbf_node.getrawmempool() From 0c520679ab5f0ba99584cb356ec28ef089f14735 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Mon, 16 May 2022 18:03:02 -0300 Subject: [PATCH 2/2] doc: add release notes for `abandoned` field in `gettransaction` and `listtransactions` --- doc/release-notes-25158.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 doc/release-notes-25158.md diff --git a/doc/release-notes-25158.md b/doc/release-notes-25158.md new file mode 100644 index 00000000000..ce8ab53ddd8 --- /dev/null +++ b/doc/release-notes-25158.md @@ -0,0 +1,6 @@ +RPC Wallet +---------- + +- The `gettransaction`, `listtransactions`, `listsinceblock` RPCs now return + the `abandoned` field for all transactions. Previously, the "abandoned" field + was only returned for sent transactions. (#25158) \ No newline at end of file