From d958ea005f29cd08a8e677c1ef6550bfb1bf99de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20J=C3=A4mthagen?= Date: Thu, 9 Feb 2017 10:44:21 +0100 Subject: [PATCH] lnwallet: check for correct value in HTLC outputs in commitment transaction It is possible that that there are multiple HTLCs with different values, but the same public key script. As such, a check against the value should be performed when looking for HTLC outputs in a commitment transaction. --- lnwallet/channel.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 2d142572..b294037f 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -276,7 +276,8 @@ func (c *commitment) toChannelDelta(ourCommit bool) (*channeldb.ChannelDelta, er pkScript = p.ourPkScript } for i, txOut := range c.txn.TxOut { - if bytes.Equal(txOut.PkScript, pkScript) { + if bytes.Equal(txOut.PkScript, pkScript) && + txOut.Value == int64(p.Amount) { if contains(dups[p.RHash], uint16(i)) { continue }