diff --git a/lnwallet/reservation.go b/lnwallet/reservation.go index e8e157f11..7fe8d5068 100644 --- a/lnwallet/reservation.go +++ b/lnwallet/reservation.go @@ -302,13 +302,14 @@ func (r *ChannelReservation) TheirKeys() (*btcec.PublicKey, *btcec.PublicKey) { // CompleteFundingReservation... // TODO(roasbeef): add commit sig also -func (r *ChannelReservation) CompleteReservation(theirSigs [][]byte) error { +func (r *ChannelReservation) CompleteReservation(fundingSigs [][]byte, commitmentSig []byte) error { errChan := make(chan error, 1) r.wallet.msgChan <- &addCounterPartySigsMsg{ - pendingFundingID: r.reservationID, - theirSigs: theirSigs, - err: errChan, + pendingFundingID: r.reservationID, + theirFundingSigs: fundingSigs, + theirCommitmentSig: commitmentSig, + err: errChan, } return <-errChan diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index cc335a5a1..020c5b827 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -124,7 +124,11 @@ type addCounterPartySigsMsg struct { // Should be order of sorted inputs that are theirs. Sorting is done in accordance // to BIP-69: https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki. - theirSigs [][]byte + theirFundingSigs [][]byte + + // This should be 1/2 of the signatures needed to succesfully spend our + // version of the commitment transaction. + theirCommitmentSig []byte err chan error // Buffered } @@ -676,7 +680,7 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs // Now we can complete the funding transaction by adding their // signatures to their inputs. - pendingReservation.theirFundingSigs = msg.theirSigs + pendingReservation.theirFundingSigs = msg.theirFundingSigs fundingTx := pendingReservation.partialState.fundingTx for i, txin := range fundingTx.TxIn { if txin.SignatureScript == nil { @@ -713,6 +717,12 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs } } + // At this point, wen calso record and verify their isgnature for our + // commitment transaction. + pendingReservation.partialState.theirCommitSig = msg.theirCommitmentSig + // TODO(roasbeef): verify + //commitSig := msg.theirCommitmentSig + // Funding complete, this entry can be removed from limbo. l.limboMtx.Lock() delete(l.fundingLimbo, pendingReservation.reservationID)