discovery: add missing error channel sends in processNetworkAnnouncement

Without the error channel sends, we would block the gossip message
stream upon receiving a premature channel announcement.
This commit is contained in:
Wilmer Paulino
2021-03-22 15:31:16 -07:00
parent b1309277b9
commit e713205eea
2 changed files with 12 additions and 33 deletions

View File

@@ -1612,8 +1612,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
}
// If the advertised inclusionary block is beyond our knowledge
// of the chain tip, then we'll put the announcement in limbo
// to be fully verified once we advance forward in the chain.
// of the chain tip, then we'll ignore for it now.
d.Lock()
if nMsg.isRemote && isPremature(msg.ShortChannelID, 0) {
log.Infof("Announcement for chan_id=(%v), is "+
@@ -1623,6 +1622,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
msg.ShortChannelID.BlockHeight,
d.bestHeight)
d.Unlock()
nMsg.err <- nil
return nil
}
d.Unlock()
@@ -2132,16 +2132,14 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
// By the specification, channel announcement proofs should be
// sent after some number of confirmations after channel was
// registered in bitcoin blockchain. Therefore, we check if the
// proof is premature. If so we'll halt processing until the
// expected announcement height. This allows us to be tolerant
// to other clients if this constraint was changed.
// proof is premature.
d.Lock()
if isPremature(msg.ShortChannelID, d.cfg.ProofMatureDelta) {
log.Infof("Premature proof announcement, "+
"current block height lower than needed: %v <"+
" %v, add announcement to reprocessing batch",
log.Infof("Premature proof announcement, current "+
"block height lower than needed: %v < %v",
d.bestHeight, needBlockHeight)
d.Unlock()
nMsg.err <- nil
return nil
}
d.Unlock()