From 7bebefbd8fa964656ba0fabb7538115fdc92e7cc Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 2 Feb 2016 23:43:12 -0800 Subject: [PATCH] lnwallet: fix script bug, ensure sigScript is set before verification --- lnwallet/wallet.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index cc2c1328..44134c7d 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -868,6 +868,9 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs fundingTx := pendingReservation.partialState.FundingTx for i, txin := range fundingTx.TxIn { 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 // pkscript referenced by this input. prevOut := txin.PreviousOutPoint @@ -896,8 +899,6 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs msg.err <- fmt.Errorf("cannot validate transaction: %s", err) return } - - txin.SignatureScript = pendingReservation.theirFundingSigs[i] } }