rpcserver: Clarify failure closing offline channel
This commit is contained in:
parent
d6b9907cf5
commit
445924b7a9
@ -1284,8 +1284,8 @@ func (s *Switch) htlcForwarder() {
|
||||
chanID := lnwire.NewChanIDFromOutPoint(req.ChanPoint)
|
||||
link, ok := s.linkIndex[chanID]
|
||||
if !ok {
|
||||
req.Err <- errors.Errorf("channel with "+
|
||||
"chan_id=%x not found", chanID[:])
|
||||
req.Err <- errors.Errorf("no peer for channel with "+
|
||||
"chan_id=%x", chanID[:])
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ const (
|
||||
// within the network. The ChannelID is computed using the outpoint of the
|
||||
// funding transaction (the txid, and output index). Given a funding output the
|
||||
// ChannelID can be calculated by XOR'ing the big-endian serialization of the
|
||||
// txid and the big-endian serialization of the output index, truncated to
|
||||
// 2 bytes.
|
||||
type ChannelID [32]byte
|
||||
|
||||
// ConnectionWideID is an all-zero ChannelID, which is used to represent a
|
||||
|
10
rpcserver.go
10
rpcserver.go
@ -1071,6 +1071,16 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// If the link is not known by the switch, we cannot gracefully close
|
||||
// the channel.
|
||||
channelID := lnwire.NewChanIDFromOutPoint(chanPoint)
|
||||
if _, err := r.server.htlcSwitch.GetLink(channelID); err != nil {
|
||||
rpcsLog.Debugf("Trying to non-force close offline channel with "+
|
||||
"chan_point=%v", chanPoint)
|
||||
return fmt.Errorf("unable to gracefully close channel while peer "+
|
||||
"is offline (try force closing it instead): %v", err)
|
||||
}
|
||||
|
||||
// Based on the passed fee related parameters, we'll determine
|
||||
// an appropriate fee rate for the cooperative closure
|
||||
// transaction.
|
||||
|
Loading…
Reference in New Issue
Block a user