server+peer: check ErrEdgeNotFound when enabling/disabling a channel
In this commit, we also check ErrEdgeNotFound when attempting to send an active/inactive channel update for a channel to the network. We do this as it's possible that a channel has confirmed, but it still does not meet the required number of confirmations to be publicly announced.
This commit is contained in:
parent
f13c1d2787
commit
99a4952239
6
peer.go
6
peer.go
@ -505,9 +505,9 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||
// ChannelUpdate. If this channel is already active,
|
||||
// the update won't be sent.
|
||||
err := p.server.announceChanStatus(chanPoint, false)
|
||||
if err != nil {
|
||||
peerLog.Errorf("unable to send out active "+
|
||||
"channel update: %v", err)
|
||||
if err != nil && err != channeldb.ErrEdgeNotFound {
|
||||
srvrLog.Errorf("Unable to enable channel %v: %v",
|
||||
chanPoint, err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
16
server.go
16
server.go
@ -2847,8 +2847,6 @@ func (s *server) announceChanStatus(op wire.OutPoint, disabled bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
srvrLog.Debugf("Announcing channel(%v) disabled=%v", op, disabled)
|
||||
|
||||
// Retrieve the latest update for this channel. We'll use this
|
||||
// as our starting point to send the new update.
|
||||
chanUpdate, err := s.fetchLastChanUpdateByOutPoint(op)
|
||||
@ -2888,6 +2886,8 @@ func (s *server) announceChanStatus(op wire.OutPoint, disabled bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
srvrLog.Debugf("Announcing channel(%v) disabled=%v", op, disabled)
|
||||
|
||||
// Once signed, we'll send the new update to all of our peers.
|
||||
if err := s.applyChannelUpdate(chanUpdate); err != nil {
|
||||
return err
|
||||
@ -3053,8 +3053,8 @@ func (s *server) watchChannelStatus() {
|
||||
newStatus := make(map[wire.OutPoint]activeStatus)
|
||||
for _, c := range channels {
|
||||
// We'll skip any private channels, as they
|
||||
// aren't used for routing within the network
|
||||
// by other nodes.
|
||||
// aren't used for routing within the network by
|
||||
// other nodes.
|
||||
if c.ChannelFlags&lnwire.FFAnnounceChannel == 0 {
|
||||
continue
|
||||
}
|
||||
@ -3113,10 +3113,12 @@ func (s *server) watchChannelStatus() {
|
||||
delete(status, op)
|
||||
|
||||
err = s.announceChanStatus(op, disable)
|
||||
if err != nil {
|
||||
if err != nil &&
|
||||
err != channeldb.ErrEdgeNotFound {
|
||||
|
||||
srvrLog.Errorf("Unable to "+
|
||||
"disable channel: %v",
|
||||
err)
|
||||
"disable channel %v: %v",
|
||||
op, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user