Skip to content

Commit bdc6628

Browse files
committed
Remove use of IsRBFOptIn in wallet code
This commit does not change behavior.
1 parent 80f52a2 commit bdc6628

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/interfaces/chain.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
#include <chain.h>
88
#include <chainparams.h>
9+
#include <policy/rbf.h>
910
#include <primitives/block.h>
1011
#include <sync.h>
1112
#include <threadsafety.h>
13+
#include <txmempool.h>
1214
#include <uint256.h>
1315
#include <util/system.h>
1416
#include <validation.h>
@@ -183,6 +185,11 @@ class ChainImpl : public Chain
183185
LOCK(cs_main);
184186
return GuessVerificationProgress(Params().TxData(), LookupBlockIndex(block_hash));
185187
}
188+
RBFTransactionState isRBFOptIn(const CTransaction& tx) override
189+
{
190+
LOCK(::mempool.cs);
191+
return IsRBFOptIn(tx, ::mempool);
192+
}
186193
};
187194

188195
} // namespace

src/interfaces/chain.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#ifndef BITCOIN_INTERFACES_CHAIN_H
66
#define BITCOIN_INTERFACES_CHAIN_H
77

8-
#include <optional.h>
8+
#include <optional.h> // For Optional and nullopt
9+
#include <policy/rbf.h> // For RBFTransactionState
910

1011
#include <memory>
1112
#include <stdint.h>
@@ -131,6 +132,9 @@ class Chain
131132
//! Estimate fraction of total transactions verified if blocks up to
132133
//! the specified block hash are verified.
133134
virtual double guessVerificationProgress(const uint256& block_hash) = 0;
135+
136+
//! Check if transaction is RBF opt in.
137+
virtual RBFTransactionState isRBFOptIn(const CTransaction& tx) = 0;
134138
};
135139

136140
//! Interface to let node manage chain clients (wallets, or maybe tools for

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ static void WalletTxToJSON(interfaces::Chain& chain, interfaces::Chain::Lock& lo
124124
// Add opt-in RBF status
125125
std::string rbfStatus = "no";
126126
if (confirms <= 0) {
127-
LOCK(mempool.cs);
128-
RBFTransactionState rbfState = IsRBFOptIn(*wtx.tx, mempool);
127+
RBFTransactionState rbfState = chain.isRBFOptIn(*wtx.tx);
129128
if (rbfState == RBFTransactionState::UNKNOWN)
130129
rbfStatus = "unknown";
131130
else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125)

0 commit comments

Comments
 (0)