aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2019-03-06 16:47:57 -0500
committerRussell Yanofsky <russ@yanofsky.org>2019-03-06 16:47:57 -0500
commitd358466de15ef29c1d2bccb9aebab360d574d1d0 (patch)
tree731dd3ff9701381826ca0d0e3598f2de488b812b /src/interfaces
parentb1b2b238928e7be044ad62cf1b222464907ece2c (diff)
downloadbitcoin-d358466de15ef29c1d2bccb9aebab360d574d1d0.tar.xz
Remove remaining wallet accesses to node globals
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/chain.cpp9
-rw-r--r--src/interfaces/chain.h17
-rw-r--r--src/interfaces/wallet.cpp8
-rw-r--r--src/interfaces/wallet.h3
4 files changed, 26 insertions, 11 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp
index 7913c4473e..0c765f2092 100644
--- a/src/interfaces/chain.cpp
+++ b/src/interfaces/chain.cpp
@@ -18,6 +18,7 @@
#include <protocol.h>
#include <rpc/protocol.h>
#include <rpc/server.h>
+#include <shutdown.h>
#include <sync.h>
#include <threadsafety.h>
#include <timedata.h>
@@ -340,15 +341,23 @@ public:
{
return ::mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000);
}
+ CFeeRate relayMinFee() override { return ::minRelayTxFee; }
+ CFeeRate relayIncrementalFee() override { return ::incrementalRelayFee; }
+ CFeeRate relayDustFee() override { return ::dustRelayFee; }
CAmount maxTxFee() override { return ::maxTxFee; }
bool getPruneMode() override { return ::fPruneMode; }
bool p2pEnabled() override { return g_connman != nullptr; }
bool isInitialBlockDownload() override { return IsInitialBlockDownload(); }
+ bool shutdownRequested() override { return ShutdownRequested(); }
int64_t getAdjustedTime() override { return GetAdjustedTime(); }
void initMessage(const std::string& message) override { ::uiInterface.InitMessage(message); }
void initWarning(const std::string& message) override { InitWarning(message); }
void initError(const std::string& message) override { InitError(message); }
void loadWallet(std::unique_ptr<Wallet> wallet) override { ::uiInterface.LoadWallet(wallet); }
+ void showProgress(const std::string& title, int progress, bool resume_possible) override
+ {
+ ::uiInterface.ShowProgress(title, progress, resume_possible);
+ }
std::unique_ptr<Handler> handleNotifications(Notifications& notifications) override
{
return MakeUnique<NotificationsHandlerImpl>(*this, notifications);
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index b4db9dda15..a9b05f27fc 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -202,6 +202,15 @@ public:
//! Mempool minimum fee.
virtual CFeeRate mempoolMinFee() = 0;
+ //! Relay current minimum fee (from -minrelaytxfee and -incrementalrelayfee settings).
+ virtual CFeeRate relayMinFee() = 0;
+
+ //! Relay incremental fee setting (-incrementalrelayfee), reflecting cost of relay.
+ virtual CFeeRate relayIncrementalFee() = 0;
+
+ //! Relay dust fee setting (-dustrelayfee), reflecting lowest rate it's economical to spend.
+ virtual CFeeRate relayDustFee() = 0;
+
//! 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
@@ -214,9 +223,12 @@ public:
//! Check if p2p enabled.
virtual bool p2pEnabled() = 0;
- // Check if in IBD.
+ //! Check if in IBD.
virtual bool isInitialBlockDownload() = 0;
+ //! Check if shutdown requested.
+ virtual bool shutdownRequested() = 0;
+
//! Get adjusted time.
virtual int64_t getAdjustedTime() = 0;
@@ -232,6 +244,9 @@ public:
//! Send wallet load notification to the GUI.
virtual void loadWallet(std::unique_ptr<Wallet> wallet) = 0;
+ //! Send progress indicator.
+ virtual void showProgress(const std::string& title, int progress, bool resume_possible) = 0;
+
//! Chain notifications.
class Notifications
{
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp
index 97eadac6a9..60173b29ac 100644
--- a/src/interfaces/wallet.cpp
+++ b/src/interfaces/wallet.cpp
@@ -47,8 +47,6 @@ public:
const CTransaction& get() override { return *m_tx; }
- int64_t getVirtualSize() override { return GetVirtualTransactionSize(*m_tx); }
-
bool commit(WalletValueMap value_map,
WalletOrderForm order_form,
std::string& reject_reason) override
@@ -99,12 +97,8 @@ WalletTx MakeWalletTx(interfaces::Chain::Lock& locked_chain, CWallet& wallet, co
//! Construct wallet tx status struct.
WalletTxStatus MakeWalletTxStatus(interfaces::Chain::Lock& locked_chain, const CWalletTx& wtx)
{
- LockAnnotation lock(::cs_main); // Temporary, for mapBlockIndex below. Removed in upcoming commit.
-
WalletTxStatus result;
- auto mi = ::mapBlockIndex.find(wtx.hashBlock);
- CBlockIndex* block = mi != ::mapBlockIndex.end() ? mi->second : nullptr;
- result.block_height = (block ? block->nHeight : std::numeric_limits<int>::max());
+ result.block_height = locked_chain.getBlockHeight(wtx.hashBlock).get_value_or(std::numeric_limits<int>::max());
result.blocks_to_maturity = wtx.GetBlocksToMaturity(locked_chain);
result.depth_in_main_chain = wtx.GetDepthInMainChain(locked_chain);
result.time_received = wtx.nTimeReceived;
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index a931e5fafb..cabc455b1f 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -292,9 +292,6 @@ public:
//! Get transaction data.
virtual const CTransaction& get() = 0;
- //! Get virtual transaction size.
- virtual int64_t getVirtualSize() = 0;
-
//! Send pending transaction and commit to wallet.
virtual bool commit(WalletValueMap value_map,
WalletOrderForm order_form,