mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-29 03:01:52 +01:00
lnwallet: correctly adjust cleared funds during AddHTLC
* When adding an HTLC, the update to settled balances are to the side sending the HTLC.
This commit is contained in:
parent
7ec419bde5
commit
3fe82f475f
@ -136,11 +136,11 @@ func (lc *LightningChannel) AddHTLC(timeout uint32, value btcutil.Amount,
|
|||||||
// Re-calculate the amount of cleared funds for each side.
|
// Re-calculate the amount of cleared funds for each side.
|
||||||
var amountToUs, amountToThem btcutil.Amount
|
var amountToUs, amountToThem btcutil.Amount
|
||||||
if payToUs {
|
if payToUs {
|
||||||
amountToUs = lc.channelState.OurBalance + value
|
amountToUs = lc.channelState.OurBalance
|
||||||
amountToThem = lc.channelState.TheirBalance - value
|
amountToThem = lc.channelState.TheirBalance - value
|
||||||
} else {
|
} else {
|
||||||
amountToUs = lc.channelState.OurBalance - value
|
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.
|
// Re-create copies of the current commitment transactions to be updated.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user