mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Create new signal for notification of new blocks. Use w/ -blocknotify
This commit is contained in:
parent
beb36e800c
commit
c7b6117deb
3 changed files with 17 additions and 5 deletions
|
|
@ -2162,16 +2162,14 @@ bool ActivateBestChain(CValidationState &state) {
|
|||
uint256 hashNewTip = pindexNewTip->GetBlockHash();
|
||||
// Relay inventory, but don't relay old inventory during initial block download.
|
||||
int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate();
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
|
||||
pnode->PushInventory(CInv(MSG_BLOCK, hashNewTip));
|
||||
|
||||
std::string strCmd = GetArg("-blocknotify", "");
|
||||
if (!strCmd.empty()) {
|
||||
boost::replace_all(strCmd, "%s", hashNewTip.GetHex());
|
||||
boost::thread t(runCommand, strCmd); // thread runs free
|
||||
}
|
||||
|
||||
uiInterface.NotifyBlockTip(hashNewTip);
|
||||
}
|
||||
} while(pindexMostWork != chainActive.Tip());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue