mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
lnwallet: CompleteCooperativeClose now accepts final fee in btcutil.Amount
This commit is contained in:
parent
e96c62db65
commit
98a8951e5b
1 changed files with 3 additions and 4 deletions
|
@ -1997,7 +1997,6 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
|
||||||
currentStateNum := lc.currentHeight
|
currentStateNum := lc.currentHeight
|
||||||
|
|
||||||
// TODO(roasbeef): track heights distinctly?
|
// TODO(roasbeef): track heights distinctly?
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
// If state number spending transaction matches the current latest
|
// If state number spending transaction matches the current latest
|
||||||
// state, then they've initiated a unilateral close. So we'll trigger
|
// state, then they've initiated a unilateral close. So we'll trigger
|
||||||
|
@ -4610,7 +4609,7 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
|
||||||
// signatures including the proper sighash byte.
|
// signatures including the proper sighash byte.
|
||||||
func (lc *LightningChannel) CompleteCooperativeClose(localSig, remoteSig,
|
func (lc *LightningChannel) CompleteCooperativeClose(localSig, remoteSig,
|
||||||
localDeliveryScript, remoteDeliveryScript []byte,
|
localDeliveryScript, remoteDeliveryScript []byte,
|
||||||
proposedFee uint64) (*wire.MsgTx, error) {
|
proposedFee btcutil.Amount) (*wire.MsgTx, error) {
|
||||||
|
|
||||||
lc.Lock()
|
lc.Lock()
|
||||||
defer lc.Unlock()
|
defer lc.Unlock()
|
||||||
|
@ -4629,9 +4628,9 @@ func (lc *LightningChannel) CompleteCooperativeClose(localSig, remoteSig,
|
||||||
theirBalance := localCommit.RemoteBalance.ToSatoshis()
|
theirBalance := localCommit.RemoteBalance.ToSatoshis()
|
||||||
|
|
||||||
if lc.channelState.IsInitiator {
|
if lc.channelState.IsInitiator {
|
||||||
ourBalance = ourBalance - btcutil.Amount(proposedFee)
|
ourBalance = ourBalance - proposedFee
|
||||||
} else {
|
} else {
|
||||||
theirBalance = theirBalance - btcutil.Amount(proposedFee)
|
theirBalance = theirBalance - proposedFee
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the transaction used to return the current settled balance
|
// Create the transaction used to return the current settled balance
|
||||||
|
|
Loading…
Add table
Reference in a new issue