rpcwallet: don't re-use sign desc in loop

This commit fixes an issue with signing for mixed inputs in a remote
signing setup where the re-use of the sign descriptor would lead to the
sign method not being reset correctly if a p2wkh input is following a
p2tr input.
This commit is contained in:
Oliver Gugger committed 2022-11-11 10:20:09 +01:00
1 parent b3f6fe315e
commit ed2e542515
1 file changed
+5 -2
+5 -2
View File
@@ -139,12 +139,15 @@ func (r *RPCKeyRing) SendOutputs(outputs []*wire.TxOut,
// We know at this point that we only have inputs from our own wallet. // We know at this point that we only have inputs from our own wallet.
// So we can just compute the input script using the remote signer. // So we can just compute the input script using the remote signer.
outputFetcher := lnwallet.NewWalletPrevOutputFetcher(r.WalletController) outputFetcher := lnwallet.NewWalletPrevOutputFetcher(r.WalletController)
for i, txIn := range tx.TxIn {
signDesc := input.SignDescriptor{ signDesc := input.SignDescriptor{
HashType: txscript.SigHashAll, HashType: txscript.SigHashAll,
SigHashes: txscript.NewTxSigHashes(tx, outputFetcher), SigHashes: txscript.NewTxSigHashes(
tx, outputFetcher,
),
PrevOutputFetcher: outputFetcher, PrevOutputFetcher: outputFetcher,
} }
for i, txIn := range tx.TxIn {
// We can only sign this input if it's ours, so we'll ask the // We can only sign this input if it's ours, so we'll ask the
// watch-only wallet if it can map this outpoint into a coin we // watch-only wallet if it can map this outpoint into a coin we
// own. If not, then we can't continue because our wallet state // own. If not, then we can't continue because our wallet state