Is -blocknotify triggered during catch-up?

5

My node is way behind and I noticed the -blocknoitfy action specified in bitcoin.conf is not being triggered. Which is OK for now, because the node has so much catching up to do, the script wouldn't do any good anyway.

Is this correct behavior? At what point does blocknotify start triggering again? My experience is that after a few hours or even a day of downtime, it gets triggered for every block during catch-up (so it could be a dozen triggers all at once, for example)

pinhead

Posted 2017-01-20T20:15:05.510

Reputation: 2 356

Answers

6

Yes, this is by design.

The notify action is run in the function BlockNotifyCallback (init.cpp), and you can see:

static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex)
{
    if (initialSync || !pBlockIndex)
        return;
    // ...
}

The initialSync argument comes from the return value of IsInitialBlockDownload() (in validate.cpp). It checks several things to determine if the initial block download is ongoing. Probably the operative one here is a check whether the most recent known block has a timestamp that is more than 24 hours earlier than the current system time.

So it appears you will start getting notifications when you are 24 hours behind or less.

Nate Eldredge

Posted 2017-01-20T20:15:05.510

Reputation: 21 420