Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/node.cpp
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | public: | ||||
height = ::pindexBestHeader->nHeight; | height = ::pindexBestHeader->nHeight; | ||||
block_time = ::pindexBestHeader->GetBlockTime(); | block_time = ::pindexBestHeader->GetBlockTime(); | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
int getNumBlocks() override { | int getNumBlocks() override { | ||||
LOCK(::cs_main); | LOCK(::cs_main); | ||||
assert(std::addressof(::ChainActive()) == | |||||
std::addressof(chainman().ActiveChain())); | |||||
return chainman().ActiveChain().Height(); | return chainman().ActiveChain().Height(); | ||||
} | } | ||||
BlockHash getBestBlockHash() override { | BlockHash getBestBlockHash() override { | ||||
const CBlockIndex *tip = | const CBlockIndex *tip = | ||||
WITH_LOCK(::cs_main, return chainman().ActiveTip()); | WITH_LOCK(::cs_main, return chainman().ActiveTip()); | ||||
return tip ? tip->GetBlockHash() | return tip ? tip->GetBlockHash() | ||||
: Params().GenesisBlock().GetHash(); | : Params().GenesisBlock().GetHash(); | ||||
} | } | ||||
int64_t getLastBlockTime() override { | int64_t getLastBlockTime() override { | ||||
LOCK(::cs_main); | LOCK(::cs_main); | ||||
assert(std::addressof(::ChainActive()) == | |||||
std::addressof(chainman().ActiveChain())); | |||||
if (chainman().ActiveChain().Tip()) { | if (chainman().ActiveChain().Tip()) { | ||||
return chainman().ActiveChain().Tip()->GetBlockTime(); | return chainman().ActiveChain().Tip()->GetBlockTime(); | ||||
} | } | ||||
// Genesis block's time of current network | // Genesis block's time of current network | ||||
return Params().GenesisBlock().GetBlockTime(); | return Params().GenesisBlock().GetBlockTime(); | ||||
} | } | ||||
double getVerificationProgress() override { | double getVerificationProgress() override { | ||||
const CBlockIndex *tip; | const CBlockIndex *tip; | ||||
{ | { | ||||
LOCK(::cs_main); | LOCK(::cs_main); | ||||
assert(std::addressof(::ChainActive()) == | |||||
std::addressof(chainman().ActiveChain())); | |||||
tip = chainman().ActiveChain().Tip(); | tip = chainman().ActiveChain().Tip(); | ||||
} | } | ||||
return GuessVerificationProgress(Params().TxData(), tip); | return GuessVerificationProgress(Params().TxData(), tip); | ||||
} | } | ||||
bool isInitialBlockDownload() override { | bool isInitialBlockDownload() override { | ||||
return chainman().ActiveChainstate().IsInitialBlockDownload(); | return chainman().ActiveChainstate().IsInitialBlockDownload(); | ||||
} | } | ||||
bool getReindex() override { return ::fReindex; } | bool getReindex() override { return ::fReindex; } | ||||
Show All 23 Lines | public: | ||||
void rpcSetTimerInterfaceIfUnset(RPCTimerInterface *iface) override { | void rpcSetTimerInterfaceIfUnset(RPCTimerInterface *iface) override { | ||||
RPCSetTimerInterfaceIfUnset(iface); | RPCSetTimerInterfaceIfUnset(iface); | ||||
} | } | ||||
void rpcUnsetTimerInterface(RPCTimerInterface *iface) override { | void rpcUnsetTimerInterface(RPCTimerInterface *iface) override { | ||||
RPCUnsetTimerInterface(iface); | RPCUnsetTimerInterface(iface); | ||||
} | } | ||||
bool getUnspentOutput(const COutPoint &output, Coin &coin) override { | bool getUnspentOutput(const COutPoint &output, Coin &coin) override { | ||||
LOCK(::cs_main); | LOCK(::cs_main); | ||||
assert(std::addressof(::ChainstateActive()) == | |||||
std::addressof(chainman().ActiveChainstate())); | |||||
return chainman().ActiveChainstate().CoinsTip().GetCoin(output, | return chainman().ActiveChainstate().CoinsTip().GetCoin(output, | ||||
coin); | coin); | ||||
} | } | ||||
WalletClient &walletClient() override { | WalletClient &walletClient() override { | ||||
return *Assert(m_context->wallet_client); | return *Assert(m_context->wallet_client); | ||||
} | } | ||||
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { | std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { | ||||
return MakeHandler(::uiInterface.InitMessage_connect(fn)); | return MakeHandler(::uiInterface.InitMessage_connect(fn)); | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |