htlcswitch+lnwallet: add malformed payment descriptor

This commit is contained in:
Andrey Samokhvalov
2017-08-14 14:21:57 +03:00
committed by Olaoluwa Osuntokun
parent e29193d550
commit a10ed36e8f
2 changed files with 69 additions and 5 deletions

View File

@@ -1513,7 +1513,9 @@ func (l *channelLink) sendHTLCError(rHash [32]byte, failure lnwire.FailureMessag
// to the payment sender.
func (l *channelLink) sendMalformedHTLCError(rHash [32]byte, code lnwire.FailCode,
onionBlob []byte) {
index, err := l.channel.FailHTLC(rHash)
shaOnionBlob := sha256.Sum256(onionBlob)
index, err := l.channel.MalformedFailHTLC(rHash, code, shaOnionBlob)
if err != nil {
log.Errorf("unable cancel htlc: %v", err)
return
@@ -1522,7 +1524,7 @@ func (l *channelLink) sendMalformedHTLCError(rHash [32]byte, code lnwire.FailCod
l.cfg.Peer.SendMessage(&lnwire.UpdateFailMalformedHTLC{
ChanID: l.ChanID(),
ID: index,
ShaOnionBlob: sha256.Sum256(onionBlob),
ShaOnionBlob: shaOnionBlob,
FailureCode: code,
})
}