aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-07-31 16:31:29 -0400
committerRussell Yanofsky <russ@yanofsky.org>2019-02-22 15:43:02 -0400
commitd02b34c8a8bd446c9620fe626b4379617f9a9639 (patch)
treeb782a9fcc3835c09f94e5a2d9d7060b46b4c9088 /src/interfaces
parente2c8ba9f6e782e2545b71e9e34b967c69e18c7f0 (diff)
downloadbitcoin-d02b34c8a8bd446c9620fe626b4379617f9a9639.tar.xz
Remove use of AcceptToMemoryPool in wallet code
This commit does not change behavior.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/chain.cpp8
-rw-r--r--src/interfaces/chain.h13
2 files changed, 20 insertions, 1 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp
index 4f60448958..9f02514df3 100644
--- a/src/interfaces/chain.cpp
+++ b/src/interfaces/chain.cpp
@@ -11,6 +11,7 @@
#include <policy/policy.h>
#include <policy/rbf.h>
#include <primitives/block.h>
+#include <primitives/transaction.h>
#include <protocol.h>
#include <sync.h>
#include <threadsafety.h>
@@ -146,6 +147,12 @@ class LockImpl : public Chain::Lock
LockAnnotation lock(::cs_main);
return CheckFinalTx(tx);
}
+ bool submitToMemoryPool(CTransactionRef tx, CAmount absurd_fee, CValidationState& state) override
+ {
+ LockAnnotation lock(::cs_main);
+ return AcceptToMemoryPool(::mempool, state, tx, nullptr /* missing inputs */, nullptr /* txn replaced */,
+ false /* bypass limits */, absurd_fee);
+ }
};
class LockingStateImpl : public LockImpl, public UniqueLock<CCriticalSection>
@@ -237,6 +244,7 @@ public:
{
return ::mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000);
}
+ CAmount maxTxFee() override { return ::maxTxFee; }
bool getPruneMode() override { return ::fPruneMode; }
bool p2pEnabled() override { return g_connman != nullptr; }
int64_t getAdjustedTime() override { return GetAdjustedTime(); }
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index b1e3f59452..be486bd4fc 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -7,6 +7,7 @@
#include <optional.h> // For Optional and nullopt
#include <policy/rbf.h> // For RBFTransactionState
+#include <primitives/transaction.h> // For CTransactionRef
#include <memory>
#include <stddef.h>
@@ -16,7 +17,7 @@
class CBlock;
class CScheduler;
-class CTransaction;
+class CValidationState;
class uint256;
struct CBlockLocator;
struct FeeCalculation;
@@ -109,6 +110,10 @@ public:
//! Check if transaction will be final given chain height current time.
virtual bool checkFinalTx(const CTransaction& tx) = 0;
+
+ //! Add transaction to memory pool if the transaction fee is below the
+ //! amount specified by absurd_fee (as a safeguard). */
+ virtual bool submitToMemoryPool(CTransactionRef tx, CAmount absurd_fee, CValidationState& state) = 0;
};
//! Return Lock interface. Chain is locked when this is called, and
@@ -159,6 +164,12 @@ public:
//! Pool min fee.
virtual CFeeRate mempoolMinFee() = 0;
+ //! Get node max tx fee setting (-maxtxfee).
+ //! This could be replaced by a per-wallet max fee, as proposed at
+ //! https://github.com/bitcoin/bitcoin/issues/15355
+ //! But for the time being, wallets call this to access the node setting.
+ virtual CAmount maxTxFee() = 0;
+
//! Check if pruning is enabled.
virtual bool getPruneMode() = 0;