discovery/gossiper: return on errChan in case of ChanAnn/Upd on wrong chain
Previously we wouldn't return anything in the case where the announcement were meant for a chain we didn't recognize. After this change we should return an error on the error channel in all flows within the gossiper.
This commit is contained in:
parent
54f67f72b1
commit
d0e8aeece1
@ -1653,12 +1653,16 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []n
|
|||||||
// We'll ignore any channel announcements that target any chain
|
// We'll ignore any channel announcements that target any chain
|
||||||
// other than the set of chains we know of.
|
// other than the set of chains we know of.
|
||||||
if !bytes.Equal(msg.ChainHash[:], d.cfg.ChainHash[:]) {
|
if !bytes.Equal(msg.ChainHash[:], d.cfg.ChainHash[:]) {
|
||||||
log.Errorf("Ignoring ChannelAnnouncement from "+
|
err := fmt.Errorf("Ignoring ChannelAnnouncement from "+
|
||||||
"chain=%v, gossiper on chain=%v", msg.ChainHash,
|
"chain=%v, gossiper on chain=%v", msg.ChainHash,
|
||||||
d.cfg.ChainHash)
|
d.cfg.ChainHash)
|
||||||
|
log.Errorf(err.Error())
|
||||||
|
|
||||||
d.rejectMtx.Lock()
|
d.rejectMtx.Lock()
|
||||||
d.recentRejects[msg.ShortChannelID.ToUint64()] = struct{}{}
|
d.recentRejects[msg.ShortChannelID.ToUint64()] = struct{}{}
|
||||||
d.rejectMtx.Unlock()
|
d.rejectMtx.Unlock()
|
||||||
|
|
||||||
|
nMsg.err <- err
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1863,12 +1867,16 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []n
|
|||||||
// We'll ignore any channel announcements that target any chain
|
// We'll ignore any channel announcements that target any chain
|
||||||
// other than the set of chains we know of.
|
// other than the set of chains we know of.
|
||||||
if !bytes.Equal(msg.ChainHash[:], d.cfg.ChainHash[:]) {
|
if !bytes.Equal(msg.ChainHash[:], d.cfg.ChainHash[:]) {
|
||||||
log.Errorf("Ignoring ChannelUpdate from "+
|
err := fmt.Errorf("Ignoring ChannelUpdate from "+
|
||||||
"chain=%v, gossiper on chain=%v", msg.ChainHash,
|
"chain=%v, gossiper on chain=%v", msg.ChainHash,
|
||||||
d.cfg.ChainHash)
|
d.cfg.ChainHash)
|
||||||
|
log.Errorf(err.Error())
|
||||||
|
|
||||||
d.rejectMtx.Lock()
|
d.rejectMtx.Lock()
|
||||||
d.recentRejects[msg.ShortChannelID.ToUint64()] = struct{}{}
|
d.recentRejects[msg.ShortChannelID.ToUint64()] = struct{}{}
|
||||||
d.rejectMtx.Unlock()
|
d.rejectMtx.Unlock()
|
||||||
|
|
||||||
|
nMsg.err <- err
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user