peer: call disableChannel with disabled=false after loading channels
This to ensure now active channel is available in the router, for path finding, as it might have been disabled if the peer has been offline a while.
This commit is contained in:
parent
e9cc7492a9
commit
5deffd228c
19
peer.go
19
peer.go
@ -318,6 +318,7 @@ func (p *peer) Start() error {
|
||||
// loadActiveChannels creates indexes within the peer for tracking all active
|
||||
// channels returned by the database.
|
||||
func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||
var activeChans []wire.OutPoint
|
||||
for _, dbChan := range chans {
|
||||
lnChan, err := lnwallet.NewLightningChannel(
|
||||
p.server.cc.signer, p.server.witnessBeacon, dbChan,
|
||||
@ -425,8 +426,26 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||
p.activeChanMtx.Lock()
|
||||
p.activeChannels[chanID] = lnChan
|
||||
p.activeChanMtx.Unlock()
|
||||
|
||||
activeChans = append(activeChans, *chanPoint)
|
||||
}
|
||||
|
||||
// As a final measure we launch a goroutine that will ensure the
|
||||
// channels are not currently disabled, as that will make us skip it
|
||||
// during path finding.
|
||||
go func() {
|
||||
for _, chanPoint := range activeChans {
|
||||
// Set the channel disabled=false by sending out a new
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -3112,6 +3112,9 @@ func (s *server) watchChannelStatus() {
|
||||
|
||||
// We'll send out an update for all channels that have
|
||||
// had their status unchanged for longer than the limit.
|
||||
// NOTE: We also make sure to activate any channel when
|
||||
// we connect to a peer, to make them available for
|
||||
// path finding immediately.
|
||||
for op, st := range status {
|
||||
disable := !st.active
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user