lnwallet: Change channel update methods to accept HTLC ID.

Previously, some methods on a LightningChannel like SettleHTLC and
FailHTLC would identify HTLCs by payment hash. This would not always
work correctly if there are multiple HTLCs with the same payment hash,
so instead we change these methods to identify HTLCs by their unique
identifiers instead.
This commit is contained in:
Jim Posen
2017-10-24 00:48:52 -07:00
committed by Olaoluwa Osuntokun
parent 1328e61c00
commit 317b44e220
4 changed files with 181 additions and 140 deletions

View File

@@ -1583,6 +1583,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) {
// remain unchanged (but Alice will need to pay the fee for the extra
// HTLC).
updateMsg := &lnwire.UpdateAddHTLC{
ID: 0,
Amount: htlcAmt,
Expiry: 9,
PaymentHash: htlc.PaymentHash, // Re-using the same payment hash.
@@ -1607,6 +1608,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) {
// Finally, we'll test the scenario of failing an HTLC received by the
// remote node. This should result in no perceived bandwidth changes.
htlcAdd := &lnwire.UpdateAddHTLC{
ID: 1,
Amount: htlcAmt,
Expiry: 9,
PaymentHash: htlc.PaymentHash,