lnwallet: fix script bug, ensure sigScript is set before verification

This commit is contained in:
Olaoluwa Osuntokun 2016-02-02 23:43:12 -08:00
parent 74ee5334f4
commit 7bebefbd8f

@ -868,6 +868,9 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
fundingTx := pendingReservation.partialState.FundingTx fundingTx := pendingReservation.partialState.FundingTx
for i, txin := range fundingTx.TxIn { for i, txin := range fundingTx.TxIn {
if txin.SignatureScript == nil { if txin.SignatureScript == nil {
// Attach the signature so we can verify it below.
txin.SignatureScript = pendingReservation.theirFundingSigs[i]
// Fetch the alleged previous output along with the // Fetch the alleged previous output along with the
// pkscript referenced by this input. // pkscript referenced by this input.
prevOut := txin.PreviousOutPoint prevOut := txin.PreviousOutPoint
@ -896,8 +899,6 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
msg.err <- fmt.Errorf("cannot validate transaction: %s", err) msg.err <- fmt.Errorf("cannot validate transaction: %s", err)
return return
} }
txin.SignatureScript = pendingReservation.theirFundingSigs[i]
} }
} }