From 3fe82f475fdc229a7ff83697c42c156c3df34456 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 5 Jan 2016 12:57:17 -0800 Subject: [PATCH] lnwallet: correctly adjust cleared funds during AddHTLC * When adding an HTLC, the update to settled balances are to the side sending the HTLC. --- lnwallet/channel.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 28ed6f45..dacd0a54 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -136,11 +136,11 @@ func (lc *LightningChannel) AddHTLC(timeout uint32, value btcutil.Amount, // Re-calculate the amount of cleared funds for each side. var amountToUs, amountToThem btcutil.Amount if payToUs { - amountToUs = lc.channelState.OurBalance + value + amountToUs = lc.channelState.OurBalance amountToThem = lc.channelState.TheirBalance - value } else { amountToUs = lc.channelState.OurBalance - value - amountToThem = lc.channelState.TheirBalance + value + amountToThem = lc.channelState.TheirBalance } // Re-create copies of the current commitment transactions to be updated.