lnwallet: no longer return fee from CreateCloseProposal

In this commit, we modify CreateCloseProposal to no longer return the
same fee passed in. In the past, this method accepted a fee rat rather
than an absolute fee, and would return the computed absolute fee. Now
that the method takes the absolute fee directly, this is unnecessary.
This commit is contained in:
Olaoluwa Osuntokun 2017-11-23 00:36:20 -06:00
parent 6d10677ef5
commit e96c62db65
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -4547,8 +4547,8 @@ func (lc *LightningChannel) ForceClose() (*ForceCloseSummary, error) {
// //
// TODO(roasbeef): caller should initiate signal to reject all incoming HTLCs, // TODO(roasbeef): caller should initiate signal to reject all incoming HTLCs,
// settle any in flight. // settle any in flight.
func (lc *LightningChannel) CreateCloseProposal(proposedFee uint64, func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
localDeliveryScript, remoteDeliveryScript []byte) ([]byte, uint64, error) { localDeliveryScript, remoteDeliveryScript []byte) ([]byte, error) {
lc.Lock() lc.Lock()
defer lc.Unlock() defer lc.Unlock()
@ -4556,7 +4556,7 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee uint64,
// If we've already closed the channel, then ignore this request. // If we've already closed the channel, then ignore this request.
if lc.status == channelClosed { if lc.status == channelClosed {
// TODO(roasbeef): check to ensure no pending payments // TODO(roasbeef): check to ensure no pending payments
return nil, 0, ErrChanClosing return nil, ErrChanClosing
} }
// Subtract the proposed fee from the appropriate balance, taking care // Subtract the proposed fee from the appropriate balance, taking care
@ -4567,9 +4567,9 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee uint64,
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
} }
closeTx := CreateCooperativeCloseTx(lc.fundingTxIn, closeTx := CreateCooperativeCloseTx(lc.fundingTxIn,
@ -4582,7 +4582,7 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee uint64,
// negative output. // negative output.
tx := btcutil.NewTx(closeTx) tx := btcutil.NewTx(closeTx)
if err := blockchain.CheckTransactionSanity(tx); err != nil { if err := blockchain.CheckTransactionSanity(tx); err != nil {
return nil, 0, err return nil, err
} }
// Finally, sign the completed cooperative closure transaction. As the // Finally, sign the completed cooperative closure transaction. As the
@ -4592,14 +4592,14 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee uint64,
lc.signDesc.SigHashes = txscript.NewTxSigHashes(closeTx) lc.signDesc.SigHashes = txscript.NewTxSigHashes(closeTx)
sig, err := lc.signer.SignOutputRaw(closeTx, lc.signDesc) sig, err := lc.signer.SignOutputRaw(closeTx, lc.signDesc)
if err != nil { if err != nil {
return nil, 0, err return nil, err
} }
// As everything checks out, indicate in the channel status that a // As everything checks out, indicate in the channel status that a
// channel closure has been initiated. // channel closure has been initiated.
lc.status = channelClosing lc.status = channelClosing
return sig, proposedFee, nil return sig, nil
} }
// CompleteCooperativeClose completes the cooperative closure of the target // CompleteCooperativeClose completes the cooperative closure of the target