diff --git a/netsync/manager.go b/netsync/manager.go index da366a010..eb912f20a 100644 --- a/netsync/manager.go +++ b/netsync/manager.go @@ -7,12 +7,13 @@ package netsync import ( "container/list" "fmt" - "github.com/pkg/errors" "net" "sync" "sync/atomic" "time" + "github.com/pkg/errors" + "github.com/daglabs/btcd/blockdag" "github.com/daglabs/btcd/dagconfig" "github.com/daglabs/btcd/database" @@ -1290,16 +1291,13 @@ func (sm *SyncManager) handleBlockDAGNotification(notification *blockdag.Notific } }) - // Don't relay if we are not current or the block was just now unorphaned. - // Other peers that are current should already know about it - if !sm.current() || data.WasUnorphaned { - return + // Relay if we are current and the block was not just now unorphaned. + // Otherwise peers that are current should already know about it + if sm.current() && !data.WasUnorphaned { + iv := wire.NewInvVect(wire.InvTypeBlock, block.Hash()) + sm.peerNotifier.RelayInventory(iv, block.MsgBlock().Header) } - // Generate the inventory vector and relay it. - iv := wire.NewInvVect(wire.InvTypeBlock, block.Hash()) - sm.peerNotifier.RelayInventory(iv, block.MsgBlock().Header) - for msg := range ch { sm.peerNotifier.TransactionConfirmed(msg.Tx) sm.peerNotifier.AnnounceNewTransactions(msg.AcceptedTxs)