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.
This commit is contained in:
Olaoluwa Osuntokun 2017-07-30 13:26:09 -07:00
parent 40e9120c04
commit 8121bc77ce
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

View File

@ -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()