aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/node.cpp
diff options
context:
space:
mode:
authorfurszy <[email protected]>2020-01-23 19:31:16 -0300
committerfurszy <[email protected]>2020-05-23 20:02:04 -0300
commit2f867203b0c7a4438ce484be4cfa2b29dbf1abf0 (patch)
treee8db2784b603a7c802625cef6db7d18b0a4236ad /src/interfaces/node.cpp
parentMerge #18530: Add test for -blocksonly and -whitelistforcerelay param interac... (diff)
downloaddiscoin-2f867203b0c7a4438ce484be4cfa2b29dbf1abf0.tar.xz
discoin-2f867203b0c7a4438ce484be4cfa2b29dbf1abf0.zip
Added best block hash to the NotifyHeaderTip and NotifyBlockTip signals.
[ClientModel] best header/block hash cached.
Diffstat (limited to 'src/interfaces/node.cpp')
-rw-r--r--src/interfaces/node.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp
index 3c94e44b5..582bf68ff 100644
--- a/src/interfaces/node.cpp
+++ b/src/interfaces/node.cpp
@@ -187,6 +187,11 @@ public:
LOCK(::cs_main);
return ::ChainActive().Height();
}
+ uint256 getBestBlockHash() override
+ {
+ const CBlockIndex* tip = WITH_LOCK(::cs_main, return ::ChainActive().Tip());
+ return tip ? tip->GetBlockHash() : Params().GenesisBlock().GetHash();
+ }
int64_t getLastBlockTime() override
{
LOCK(::cs_main);
@@ -310,7 +315,7 @@ public:
std::unique_ptr<Handler> handleNotifyBlockTip(NotifyBlockTipFn fn) override
{
return MakeHandler(::uiInterface.NotifyBlockTip_connect([fn](SynchronizationState sync_state, const CBlockIndex* block) {
- fn(sync_state, block->nHeight, block->GetBlockTime(),
+ fn(sync_state, block->GetBlockHash(), block->nHeight, block->GetBlockTime(),
GuessVerificationProgress(Params().TxData(), block));
}));
}
@@ -318,7 +323,7 @@ public:
{
return MakeHandler(
::uiInterface.NotifyHeaderTip_connect([fn](SynchronizationState sync_state, const CBlockIndex* block) {
- fn(sync_state, block->nHeight, block->GetBlockTime(),
+ fn(sync_state, block->GetBlockHash(), block->nHeight, block->GetBlockTime(),
/* verification progress is unused when a header was received */ 0);
}));
}