From 3f4b1592a3a50549e1158b8c2a150b011d43bb53 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 10 Nov 2017 19:38:46 -0800 Subject: [PATCH] lnwallet: add logging error message is unable to carry HTLC in state machine --- lnwallet/channel.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 3ab638e0..9016c8f4 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -3663,7 +3663,8 @@ func (lc *LightningChannel) AddHTLC(htlc *lnwire.UpdateAddHTLC) (uint64, error) // To ensure that we can actually fully accept this new HTLC, we'll // calculate the current available bandwidth, and subtract the value // ofthe HTLC from it. - availableBalance := lc.availableBalance() + initialBalance := lc.availableBalance() + availableBalance := initialBalance availableBalance -= htlc.Amount feePerKw := lc.channelState.LocalCommitment.FeePerKw @@ -3685,6 +3686,9 @@ func (lc *LightningChannel) AddHTLC(htlc *lnwire.UpdateAddHTLC) (uint64, error) // reject it with an error. if availableBalance < 0 { // TODO(roasbeef): also needs to respect reservation + // * expand to add context err msg + walletLog.Errorf("Unable to carry added HTLC: amt=%v, bal=%v", + htlc.Amount, availableBalance) return 0, ErrInsufficientBalance }