mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-28 14:55:22 +02:00
wallet: mark bip125-replaceable key as deprecated in transaction RPCs
Transactions are replaceable by default since v28 and the corresponding tweaking argument has been removed since v29. The related key from the mempool RPC has been marked deprecated as well since v29, this patch does the same for the wallet transaction RPCs such as listtransactions, listsinceblock, and gettransaction. Users can pass the -deprecatedrpc=bip125 startup argument to retrieve this key in the responses of above mentioned RPCs.
This commit is contained in:
@@ -50,15 +50,17 @@ static void WalletTxToJSON(const CWallet& wallet, const CWalletTx& wtx, UniValue
|
||||
entry.pushKV("timereceived", wtx.nTimeReceived);
|
||||
|
||||
// Add opt-in RBF status
|
||||
std::string rbfStatus = "no";
|
||||
if (confirms <= 0) {
|
||||
RBFTransactionState rbfState = chain.isRBFOptIn(*wtx.tx);
|
||||
if (rbfState == RBFTransactionState::UNKNOWN)
|
||||
rbfStatus = "unknown";
|
||||
else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125)
|
||||
rbfStatus = "yes";
|
||||
if (chain.rpcEnableDeprecated("bip125")) {
|
||||
std::string rbfStatus = "no";
|
||||
if (confirms <= 0) {
|
||||
RBFTransactionState rbfState = chain.isRBFOptIn(*wtx.tx);
|
||||
if (rbfState == RBFTransactionState::UNKNOWN)
|
||||
rbfStatus = "unknown";
|
||||
else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125)
|
||||
rbfStatus = "yes";
|
||||
}
|
||||
entry.pushKV("bip125-replaceable", rbfStatus);
|
||||
}
|
||||
entry.pushKV("bip125-replaceable", rbfStatus);
|
||||
|
||||
for (const std::pair<const std::string, std::string>& item : wtx.mapValue)
|
||||
entry.pushKV(item.first, item.second);
|
||||
@@ -405,7 +407,7 @@ static std::vector<RPCResult> TransactionDescriptionString()
|
||||
{RPCResult::Type::NUM_TIME, "time", "The transaction time expressed in " + UNIX_EPOCH_TIME + "."},
|
||||
{RPCResult::Type::NUM_TIME, "timereceived", "The time received expressed in " + UNIX_EPOCH_TIME + "."},
|
||||
{RPCResult::Type::STR, "comment", /*optional=*/true, "If a comment is associated with the transaction, only present if not empty."},
|
||||
{RPCResult::Type::STR, "bip125-replaceable", "(\"yes|no|unknown\") Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability.\n"
|
||||
{RPCResult::Type::STR, "bip125-replaceable", /*optional=*/true, "(\"yes|no|unknown\") (DEPRECATED) Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability.\n"
|
||||
"May be unknown for unconfirmed transactions not in the mempool because their unconfirmed ancestors are unknown."},
|
||||
{RPCResult::Type::ARR, "parent_descs", /*optional=*/true, "Only if 'category' is 'received'. List of parent descriptors for the output script of this coin.", {
|
||||
{RPCResult::Type::STR, "desc", "The descriptor string."},
|
||||
|
||||
@@ -510,7 +510,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
# Try with walletrejectlongchains
|
||||
# Double chain limit but require combining inputs, so we pass AttemptSelection
|
||||
self.stop_node(0)
|
||||
extra_args = ["-walletrejectlongchains", "-limitclustercount=" + str(2 * chainlimit), "-limitancestorcount=" + str(2*chainlimit)]
|
||||
extra_args = ["-deprecatedrpc=bip125", "-walletrejectlongchains", "-limitclustercount=" + str(2 * chainlimit), "-limitancestorcount=" + str(2*chainlimit)]
|
||||
self.start_node(0, extra_args=extra_args)
|
||||
|
||||
# wait until the wallet has submitted all transactions to the mempool
|
||||
|
||||
@@ -31,7 +31,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 3
|
||||
# whitelist peers to speed up tx relay / mempool sync
|
||||
self.noban_tx_relay = True
|
||||
self.extra_args = [["-walletrbf=0"]] * self.num_nodes
|
||||
self.extra_args = [["-walletrbf=0", "-deprecatedrpc=bip125"]] * self.num_nodes
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
@@ -44,7 +44,7 @@ class WalletMigrationTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 2
|
||||
self.supports_cli = False
|
||||
self.extra_args = [[], ["-deprecatedrpc=create_bdb"]]
|
||||
self.extra_args = [["-deprecatedrpc=bip125"], ["-deprecatedrpc=create_bdb"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
@@ -31,10 +31,7 @@ class WalletSendTest(BitcoinTestFramework):
|
||||
# whitelist peers to speed up tx relay / mempool sync
|
||||
self.noban_tx_relay = True
|
||||
self.supports_cli = False
|
||||
self.extra_args = [
|
||||
["-walletrbf=1", "-datacarriersize=16"],
|
||||
["-walletrbf=1", "-datacarriersize=16"]
|
||||
]
|
||||
self.extra_args = [["-walletrbf=1", "-datacarriersize=16", "-deprecatedrpc=bip125"]] * self.num_nodes
|
||||
getcontext().prec = 8 # Satoshi precision for Decimal
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
|
||||
Reference in New Issue
Block a user