Merge f4b603cff6 into merged_master (Bitcoin PR #17993)

This commit is contained in:
Andrew Poelstra 2020-11-26 01:08:53 +00:00
commit bfa1cef745
11 changed files with 71 additions and 40 deletions

View file

@ -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, BlockTip{block->nHeight, block->GetBlockTime(), block->GetBlockHash()},
GuessVerificationProgress(block, Params().GetConsensus().nPowTargetSpacing));
}));
}
@ -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, BlockTip{block->nHeight, block->GetBlockTime(), block->GetBlockHash()},
/* verification progress is unused when a header was received */ 0);
}));
}