mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Remove remaining wallet accesses to node globals
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user