From a2a96c77120bd4ce9a09c09f28631061ffb6f348 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 7 Feb 2023 22:15:10 +0100 Subject: [PATCH] lnwallet: don't re-use sign descriptor Fixes an issue where re-using a sign descriptor in a loop carried over signing information from one call to the next, which caused the remote signing issue. --- lnwallet/chanfunding/wallet_assembler.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lnwallet/chanfunding/wallet_assembler.go b/lnwallet/chanfunding/wallet_assembler.go index 6d9c1974e..c81c1cb53 100644 --- a/lnwallet/chanfunding/wallet_assembler.go +++ b/lnwallet/chanfunding/wallet_assembler.go @@ -110,13 +110,12 @@ func (f *FullIntent) CompileFundingTx(extraInputs []*wire.TxIn, prevOutFetcher := NewSegWitV0DualFundingPrevOutputFetcher( f.coinSource, extraInputs, ) - signDesc := input.SignDescriptor{ - SigHashes: txscript.NewTxSigHashes( - fundingTx, prevOutFetcher, - ), - PrevOutputFetcher: prevOutFetcher, - } + sigHashes := txscript.NewTxSigHashes(fundingTx, prevOutFetcher) for i, txIn := range fundingTx.TxIn { + signDesc := input.SignDescriptor{ + SigHashes: sigHashes, + PrevOutputFetcher: prevOutFetcher, + } // We can only sign this input if it's ours, so we'll ask the // coin source if it can map this outpoint into a coin we own. // If not, then we'll continue as it isn't our input.