mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-29 19:22:40 +01:00
htlcswitch: if we detect an InvalidCommitSigError, send over detailed error
In this commit, we add an additional case when handling a failed commitment signature. If we detect that it’s a InvalidCommitSigError, then we’ll send over an lnwire.Error message with the full details. We don’t yet properly dispatch this error on the reciting side, but that will be done in a follow up a commit.
This commit is contained in:
parent
ae1731da27
commit
dbf6a511fc
@ -893,11 +893,26 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case *lnwire.CommitSig:
|
case *lnwire.CommitSig:
|
||||||
// We just received a new updates to our local commitment chain,
|
// We just received a new updates to our local commitment
|
||||||
// validate this new commitment, closing the link if invalid.
|
// chain, validate this new commitment, closing the link if
|
||||||
|
// invalid.
|
||||||
err := l.channel.ReceiveNewCommitment(msg.CommitSig, msg.HtlcSigs)
|
err := l.channel.ReceiveNewCommitment(msg.CommitSig, msg.HtlcSigs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.fail("unable to accept new commitment: %v", err)
|
// If we were unable to reconstruct their proposed
|
||||||
|
// commitment, then we'll examine the type of error. If
|
||||||
|
// it's an InvalidCommitSigError, then we'll send a
|
||||||
|
// direct error.
|
||||||
|
//
|
||||||
|
// TODO(roasbeef): force close chan
|
||||||
|
if _, ok := err.(*lnwallet.InvalidCommitSigError); ok {
|
||||||
|
l.cfg.Peer.SendMessage(&lnwire.Error{
|
||||||
|
ChanID: l.ChanID(),
|
||||||
|
Data: []byte(err.Error()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
l.fail("ChannelPoint(%v): unable to accept new "+
|
||||||
|
"commitment: %v", l.channel.ChannelPoint(), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user