Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/node.cpp
Show All 21 Lines | |||||
#include <policy/settings.h> | #include <policy/settings.h> | ||||
#include <primitives/block.h> | #include <primitives/block.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <shutdown.h> | #include <shutdown.h> | ||||
#include <support/allocators/secure.h> | #include <support/allocators/secure.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/ref.h> | |||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <warnings.h> | #include <warnings.h> | ||||
#if defined(HAVE_CONFIG_H) | #if defined(HAVE_CONFIG_H) | ||||
#include <config/bitcoin-config.h> | #include <config/bitcoin-config.h> | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | public: | ||||
CFeeRate estimateSmartFee() override { | CFeeRate estimateSmartFee() override { | ||||
return m_context.mempool ? m_context.mempool->estimateFee() | return m_context.mempool ? m_context.mempool->estimateFee() | ||||
: CFeeRate(); | : CFeeRate(); | ||||
} | } | ||||
CFeeRate getDustRelayFee() override { return ::dustRelayFee; } | CFeeRate getDustRelayFee() override { return ::dustRelayFee; } | ||||
UniValue executeRpc(Config &config, const std::string &command, | UniValue executeRpc(Config &config, const std::string &command, | ||||
const UniValue ¶ms, | const UniValue ¶ms, | ||||
const std::string &uri) override { | const std::string &uri) override { | ||||
JSONRPCRequest req; | JSONRPCRequest req(m_context_ref); | ||||
req.params = params; | req.params = params; | ||||
req.strMethod = command; | req.strMethod = command; | ||||
req.URI = uri; | req.URI = uri; | ||||
return ::tableRPC.execute(config, req); | return ::tableRPC.execute(config, req); | ||||
} | } | ||||
std::vector<std::string> listRpcCommands() override { | std::vector<std::string> listRpcCommands() override { | ||||
return ::tableRPC.listCommands(); | return ::tableRPC.listCommands(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | public: | ||||
return MakeHandler(::uiInterface.NotifyHeaderTip_connect( | return MakeHandler(::uiInterface.NotifyHeaderTip_connect( | ||||
[fn](bool initial_download, const CBlockIndex *block) { | [fn](bool initial_download, const CBlockIndex *block) { | ||||
fn(initial_download, block->nHeight, block->GetBlockTime(), | fn(initial_download, block->nHeight, block->GetBlockTime(), | ||||
GuessVerificationProgress(Params().TxData(), block)); | GuessVerificationProgress(Params().TxData(), block)); | ||||
})); | })); | ||||
} | } | ||||
NodeContext *context() override { return &m_context; } | NodeContext *context() override { return &m_context; } | ||||
NodeContext m_context; | NodeContext m_context; | ||||
util::Ref m_context_ref{m_context}; | |||||
}; | }; | ||||
} // namespace | } // namespace | ||||
std::unique_ptr<Node> MakeNode() { | std::unique_ptr<Node> MakeNode() { | ||||
return std::make_unique<NodeImpl>(); | return std::make_unique<NodeImpl>(); | ||||
} | } | ||||
} // namespace interfaces | } // namespace interfaces |