Remove use of IsRBFOptIn in wallet code

This commit does not change behavior.
pull/764/head
Russell Yanofsky 7 years ago
parent 80f52a2267
commit bdc6628683

@ -6,9 +6,11 @@
#include <chain.h> #include <chain.h>
#include <chainparams.h> #include <chainparams.h>
#include <policy/rbf.h>
#include <primitives/block.h> #include <primitives/block.h>
#include <sync.h> #include <sync.h>
#include <threadsafety.h> #include <threadsafety.h>
#include <txmempool.h>
#include <uint256.h> #include <uint256.h>
#include <util/system.h> #include <util/system.h>
#include <validation.h> #include <validation.h>
@ -183,6 +185,11 @@ public:
LOCK(cs_main); LOCK(cs_main);
return GuessVerificationProgress(Params().TxData(), LookupBlockIndex(block_hash)); return GuessVerificationProgress(Params().TxData(), LookupBlockIndex(block_hash));
} }
RBFTransactionState isRBFOptIn(const CTransaction& tx) override
{
LOCK(::mempool.cs);
return IsRBFOptIn(tx, ::mempool);
}
}; };
} // namespace } // namespace

@ -5,7 +5,8 @@
#ifndef BITCOIN_INTERFACES_CHAIN_H #ifndef BITCOIN_INTERFACES_CHAIN_H
#define BITCOIN_INTERFACES_CHAIN_H #define BITCOIN_INTERFACES_CHAIN_H
#include <optional.h> #include <optional.h> // For Optional and nullopt
#include <policy/rbf.h> // For RBFTransactionState
#include <memory> #include <memory>
#include <stdint.h> #include <stdint.h>
@ -131,6 +132,9 @@ public:
//! Estimate fraction of total transactions verified if blocks up to //! Estimate fraction of total transactions verified if blocks up to
//! the specified block hash are verified. //! the specified block hash are verified.
virtual double guessVerificationProgress(const uint256& block_hash) = 0; virtual double guessVerificationProgress(const uint256& block_hash) = 0;
//! Check if transaction is RBF opt in.
virtual RBFTransactionState isRBFOptIn(const CTransaction& tx) = 0;
}; };
//! Interface to let node manage chain clients (wallets, or maybe tools for //! Interface to let node manage chain clients (wallets, or maybe tools for

@ -124,8 +124,7 @@ static void WalletTxToJSON(interfaces::Chain& chain, interfaces::Chain::Lock& lo
// Add opt-in RBF status // Add opt-in RBF status
std::string rbfStatus = "no"; std::string rbfStatus = "no";
if (confirms <= 0) { if (confirms <= 0) {
LOCK(mempool.cs); RBFTransactionState rbfState = chain.isRBFOptIn(*wtx.tx);
RBFTransactionState rbfState = IsRBFOptIn(*wtx.tx, mempool);
if (rbfState == RBFTransactionState::UNKNOWN) if (rbfState == RBFTransactionState::UNKNOWN)
rbfStatus = "unknown"; rbfStatus = "unknown";
else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125) else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125)

Loading…
Cancel
Save