Don't allow migration when node is syncing at launch or after waking up.

This commit is contained in:
Simon 2019-05-09 09:32:09 -07:00
parent 5aaef0b58c
commit 6921c81b9d
1 changed files with 7 additions and 1 deletions

View File

@ -581,7 +581,13 @@ void CWallet::ChainTip(const CBlockIndex *pindex,
{
if (added) {
ChainTipAdded(pindex, pblock, sproutTree, saplingTree);
RunSaplingMigration(pindex->nHeight);
// Prevent migration transactions from being created when node is syncing after launch,
// and also when node wakes up from suspension/hibernation and incoming blocks are old.
if (!IsInitialBlockDownload() &&
pblock->GetBlockTime() > GetAdjustedTime() - 3 * 60 * 60)
{
RunSaplingMigration(pindex->nHeight);
}
} else {
DecrementNoteWitnesses(pindex);
UpdateSaplingNullifierNoteMapForBlock(pblock);