lnd: avoid wiping a channel twice
This commit is contained in:
parent
39044cb2fa
commit
ff70b3afa9
7
peer.go
7
peer.go
@ -823,7 +823,11 @@ func wipeChannel(p *peer, channel *lnwallet.LightningChannel) error {
|
|||||||
// Instruct the Htlc Switch to close this link as the channel is no
|
// Instruct the Htlc Switch to close this link as the channel is no
|
||||||
// longer active.
|
// longer active.
|
||||||
p.server.htlcSwitch.UnregisterLink(p.lightningID, chanID)
|
p.server.htlcSwitch.UnregisterLink(p.lightningID, chanID)
|
||||||
htlcWireLink := p.htlcManagers[*chanID]
|
htlcWireLink, ok := p.htlcManagers[*chanID]
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
delete(p.htlcManagers, *chanID)
|
delete(p.htlcManagers, *chanID)
|
||||||
close(htlcWireLink)
|
close(htlcWireLink)
|
||||||
|
|
||||||
@ -925,6 +929,7 @@ out:
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-channel.UnilateralCloseSignal:
|
case <-channel.UnilateralCloseSignal:
|
||||||
|
// TODO(roasbeef): eliminate false positive via local close
|
||||||
peerLog.Warnf("Remote peer has closed ChannelPoint(%v) on-chain",
|
peerLog.Warnf("Remote peer has closed ChannelPoint(%v) on-chain",
|
||||||
state.chanPoint)
|
state.chanPoint)
|
||||||
if err := wipeChannel(p, channel); err != nil {
|
if err := wipeChannel(p, channel); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user