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.
This commit is contained in:
Christopher Jämthagen 2017-02-09 10:44:21 +01:00 committed by Olaoluwa Osuntokun
parent 17d29ba62e
commit d958ea005f

@ -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
}