mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-06 04:59:34 +02:00
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,
|
// ChannelUpdate. If this channel is already active,
|
||||||
// the update won't be sent.
|
// the update won't be sent.
|
||||||
err := p.server.announceChanStatus(chanPoint, false)
|
err := p.server.announceChanStatus(chanPoint, false)
|
||||||
if err != nil {
|
if err != nil && err != channeldb.ErrEdgeNotFound {
|
||||||
peerLog.Errorf("unable to send out active "+
|
srvrLog.Errorf("Unable to enable channel %v: %v",
|
||||||
"channel update: %v", err)
|
chanPoint, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
16
server.go
16
server.go
@ -2847,8 +2847,6 @@ func (s *server) announceChanStatus(op wire.OutPoint, disabled bool) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
srvrLog.Debugf("Announcing channel(%v) disabled=%v", op, disabled)
|
|
||||||
|
|
||||||
// Retrieve the latest update for this channel. We'll use this
|
// Retrieve the latest update for this channel. We'll use this
|
||||||
// as our starting point to send the new update.
|
// as our starting point to send the new update.
|
||||||
chanUpdate, err := s.fetchLastChanUpdateByOutPoint(op)
|
chanUpdate, err := s.fetchLastChanUpdateByOutPoint(op)
|
||||||
@ -2888,6 +2886,8 @@ func (s *server) announceChanStatus(op wire.OutPoint, disabled bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srvrLog.Debugf("Announcing channel(%v) disabled=%v", op, disabled)
|
||||||
|
|
||||||
// Once signed, we'll send the new update to all of our peers.
|
// Once signed, we'll send the new update to all of our peers.
|
||||||
if err := s.applyChannelUpdate(chanUpdate); err != nil {
|
if err := s.applyChannelUpdate(chanUpdate); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -3053,8 +3053,8 @@ func (s *server) watchChannelStatus() {
|
|||||||
newStatus := make(map[wire.OutPoint]activeStatus)
|
newStatus := make(map[wire.OutPoint]activeStatus)
|
||||||
for _, c := range channels {
|
for _, c := range channels {
|
||||||
// We'll skip any private channels, as they
|
// We'll skip any private channels, as they
|
||||||
// aren't used for routing within the network
|
// aren't used for routing within the network by
|
||||||
// by other nodes.
|
// other nodes.
|
||||||
if c.ChannelFlags&lnwire.FFAnnounceChannel == 0 {
|
if c.ChannelFlags&lnwire.FFAnnounceChannel == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -3113,10 +3113,12 @@ func (s *server) watchChannelStatus() {
|
|||||||
delete(status, op)
|
delete(status, op)
|
||||||
|
|
||||||
err = s.announceChanStatus(op, disable)
|
err = s.announceChanStatus(op, disable)
|
||||||
if err != nil {
|
if err != nil &&
|
||||||
|
err != channeldb.ErrEdgeNotFound {
|
||||||
|
|
||||||
srvrLog.Errorf("Unable to "+
|
srvrLog.Errorf("Unable to "+
|
||||||
"disable channel: %v",
|
"disable channel %v: %v",
|
||||||
err)
|
op, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user