[NOD-436] Fix sending empty chainChanged messages. (#477)

This commit is contained in:
stasatdaglabs 2019-11-18 14:33:07 +02:00 committed by Dan Aharoni
parent 7284815c21
commit 63bfac9740

View File

@ -97,10 +97,12 @@ func (dag *BlockDAG) maybeAcceptBlock(block *util.Block, flags BehaviorFlags) er
Block: block,
WasUnorphaned: flags&BFWasUnorphaned != 0,
})
dag.sendNotification(NTChainChanged, &ChainChangedNotificationData{
RemovedChainBlockHashes: chainUpdates.removedChainBlockHashes,
AddedChainBlockHashes: chainUpdates.addedChainBlockHashes,
})
if len(chainUpdates.removedChainBlockHashes) > 0 || len(chainUpdates.addedChainBlockHashes) > 0 {
dag.sendNotification(NTChainChanged, &ChainChangedNotificationData{
RemovedChainBlockHashes: chainUpdates.removedChainBlockHashes,
AddedChainBlockHashes: chainUpdates.addedChainBlockHashes,
})
}
dag.dagLock.Lock()
return nil