From 89326423dcb198808e75aa2cfcc88cc1f90ade19 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 14 Dec 2016 18:03:48 -0800 Subject: [PATCH] peer+htlcswitch: fix bandwidth update bug when using --debughtlc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a htlcSwitch bandwidth update bug that would manifest when two sending daemons were started with the —debughtlc flag. The invoice created for the debug HTLC has a value of 1000BTC. As a result regardless of the amount sent, the switch’s state which be updated to reflect that the daemon had just received a 1000BTC transfer. To fix this bug, we now use the value of the HTLC itself for the update, rather than the value if the invoice as they should match. --- peer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peer.go b/peer.go index 2545ead8..1e4f2bc2 100644 --- a/peer.go +++ b/peer.go @@ -1398,7 +1398,7 @@ func (p *peer) handleUpstreamMsg(state *commitmentState, msg lnwire.Message) { p.queueMsg(settleMsg, nil) delete(state.htlcsToSettle, htlc.Index) - bandwidthUpdate += invoice.Terms.Value + bandwidthUpdate += htlc.Amount settledPayments[htlc.RHash] = struct{}{} numSettled++