From 8121bc77ce73452e495e2ead701720769ee3b0e7 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 30 Jul 2017 13:26:09 -0700 Subject: [PATCH] lnwallet: add delivery scripts as a param to CreateCloseProposal+ CompleteCooperativeClose This commit modifies the methods that transition the state of the channel into an active closing state. With the new commitment design, the delivery scripts are no longer pre-committed to the initial funding messages. Instead, the scripts are sent at the instant that either side decides to shutdown within the Shutdown message. --- lnwallet/channel.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 5d566e63..f08d649e 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -3644,9 +3644,9 @@ func (lc *LightningChannel) ForceClose() (*ForceCloseSummary, error) { // returned. // // TODO(roasbeef): caller should initiate signal to reject all incoming HTLCs, -// settle any inflight. -func (lc *LightningChannel) CreateCloseProposal(feeRate uint64) ([]byte, uint64, - error) { +// settle any in flight. +func (lc *LightningChannel) CreateCloseProposal(feeRate uint64, + localDeliveryScript, remoteDeliveryScript []byte) ([]byte, uint64, error) { lc.Lock() defer lc.Unlock() @@ -3706,8 +3706,10 @@ func (lc *LightningChannel) CreateCloseProposal(feeRate uint64) ([]byte, uint64, // // NOTE: The passed local and remote sigs are expected to be fully complete // signatures including the proper sighash byte. -func (lc *LightningChannel) CompleteCooperativeClose(localSig, remoteSig []byte, +func (lc *LightningChannel) CompleteCooperativeClose(localSig, remoteSig, + localDeliveryScript, remoteDeliveryScript []byte, feeRate uint64) (*wire.MsgTx, error) { + lc.Lock() defer lc.Unlock()