Again, I may be picturing this incorrectly in my head, so let me explain my reading of the code and see if it lines up with yours.
Good idea. When you're specific like that it's easier to pinpoint where we're talking at cross purposes.
15 seconds is the future drift limit (which is I think what you are referring to when you say time granularity?).
No, I'm talking about kernel.h:
// To decrease granularity of timestamp
// Supposed to be 2^n-1
static const int STAKE_TIMESTAMP_MASK = 15;
and main.cpp:
if (IsProtocolV2(nBestHeight+1))
txCoinStake.nTime &= ~STAKE_TIMESTAMP_MASK;
int64_t nSearchTime = txCoinStake.nTime; // search to current time
That is 'AND'ing the time with binary ~1111, ie. zeroing the last 4 bits, ie. rounding down to a multiple of 16.
No, because look at the lines before that:
if (nSearchTime > nLastCoinStakeSearchTime)
{
int64_t nSearchInterval = IsProtocolV2(nBestHeight+1) ? 1 : nSearchTime - nLastCoinStakeSearchTime;
It only gets into that block if nSearchTime is greater than the last search time. And nSearchTime has already been rounded down to a multiple of 16 seconds. So it will only get into this block at most once per 16 seconds.
I also can't find the relevant part of the code that tells it to pause looking for 16 seconds.
... and now you can!
