diff options
| author | dexX7 <[email protected]> | 2018-03-13 11:46:22 +0100 |
|---|---|---|
| committer | dexX7 <[email protected]> | 2018-04-25 19:25:34 +0200 |
| commit | 820d31f95fb6b886b38dab5d378825bea7edd49e (patch) | |
| tree | a96a01ec57723420e7367177b3f3aac433328191 /src | |
| parent | Merge #13073: test: add rpcauth-test to AC_CONFIG_LINKS to fix out-of-tree ma... (diff) | |
| download | discoin-820d31f95fb6b886b38dab5d378825bea7edd49e.tar.xz discoin-820d31f95fb6b886b38dab5d378825bea7edd49e.zip | |
Add "bip125-replaceable" flag to mempool RPCs
This affects getrawmempool, getmempoolentry, getmempoolancestors and getmempooldescendants.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rpc/blockchain.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 06c68ea27..a26b8f3b4 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -15,6 +15,7 @@ #include <core_io.h> #include <policy/feerate.h> #include <policy/policy.h> +#include <policy/rbf.h> #include <primitives/transaction.h> #include <rpc/server.h> #include <streams.h> @@ -376,7 +377,8 @@ std::string EntryDescriptionString() " ... ]\n" " \"spentby\" : [ (array) unconfirmed transactions spending outputs from this transaction\n" " \"transactionid\", (string) child transaction id\n" - " ... ]\n"; + " ... ]\n" + " \"bip125-replaceable\" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee)\n"; } void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) @@ -419,6 +421,17 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) } info.pushKV("spentby", spent); + + // Add opt-in RBF status + bool rbfStatus = false; + RBFTransactionState rbfState = IsRBFOptIn(tx, mempool); + if (rbfState == RBFTransactionState::UNKNOWN) { + throw JSONRPCError(RPC_MISC_ERROR, "Transaction is not in mempool"); + } else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125) { + rbfStatus = true; + } + + info.pushKV("bip125-replaceable", rbfStatus); } UniValue mempoolToJSON(bool fVerbose) |