peer+htlcswitch: fix bandwidth update bug when using --debughtlc
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.
This commit is contained in:
parent
e3e2ba342c
commit
89326423dc
2
peer.go
2
peer.go
@ -1398,7 +1398,7 @@ func (p *peer) handleUpstreamMsg(state *commitmentState, msg lnwire.Message) {
|
|||||||
p.queueMsg(settleMsg, nil)
|
p.queueMsg(settleMsg, nil)
|
||||||
delete(state.htlcsToSettle, htlc.Index)
|
delete(state.htlcsToSettle, htlc.Index)
|
||||||
|
|
||||||
bandwidthUpdate += invoice.Terms.Value
|
bandwidthUpdate += htlc.Amount
|
||||||
settledPayments[htlc.RHash] = struct{}{}
|
settledPayments[htlc.RHash] = struct{}{}
|
||||||
|
|
||||||
numSettled++
|
numSettled++
|
||||||
|
Loading…
Reference in New Issue
Block a user