Merge pull request #7386 from guggero/remote-signer-p2tr-inputs

remote signer: fix channel funding with mixed funding input types
This commit is contained in:
Oliver Gugger authored and GitHub committed 2023-02-14 12:34:11 +01:00
commit f245591e4b
6 files changed
+72 -28

No files matched your search

+5 -6
View File
@@ -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.
+6 -2
View File
@@ -159,6 +159,10 @@ func (r *RPCKeyRing) SendOutputs(outputs []*wire.TxOut,
return nil, fmt.Errorf("error looking up utxo: %v", err)
}
if txscript.IsPayToTaproot(info.PkScript) {
signDesc.HashType = txscript.SigHashDefault
}
// Now that we know the input is ours, we'll populate the
// signDesc with the per input unique information.
signDesc.Output = &wire.TxOut{
@@ -593,7 +597,7 @@ func (r *RPCKeyRing) ComputeInputScript(tx *wire.MsgTx,
signDesc.SignMethod = input.TaprootKeySpendBIP0086SignMethod
signDesc.WitnessScript = nil
sig, err := r.remoteSign(tx, signDesc, sigScript)
sig, err := r.remoteSign(tx, signDesc, nil)
if err != nil {
return nil, fmt.Errorf("error signing with remote"+
"instance: %v", err)
@@ -617,7 +621,7 @@ func (r *RPCKeyRing) ComputeInputScript(tx *wire.MsgTx,
// Let's give the TX to the remote instance now, so it can sign the
// input.
sig, err := r.remoteSign(tx, signDesc, sigScript)
sig, err := r.remoteSign(tx, signDesc, witnessProgram)
if err != nil {
return nil, fmt.Errorf("error signing with remote instance: %v",
err)