rpcwallet: attempt to locate UTXO information in prev output fetcher

Since we might now be given a whole list of UTXOs in the PrevOutputs
field of the SignOutputRaw RPC, the previous output fetcher might
contain the information we require for the remote signing case. So
instead of failing if our wallet doesn't know each input that's being
spent, we fall back to the UTXO information contained in the previous
outputs.
This commit is contained in:
Oliver Gugger 2022-04-27 21:05:38 +02:00
parent 0051e39078
commit 5395a0fe6b
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -803,6 +803,19 @@ func (r *RPCKeyRing) remoteSign(tx *wire.MsgTx, signDesc *input.SignDescriptor,
&txIn.PreviousOutPoint,
)
if err != nil {
// Maybe we have an UTXO in the previous output fetcher?
if signDesc.PrevOutputFetcher != nil {
utxo := signDesc.PrevOutputFetcher.FetchPrevOutput(
txIn.PreviousOutPoint,
)
if utxo != nil && utxo.Value != 0 &&
len(utxo.PkScript) > 0 {
packet.Inputs[idx].WitnessUtxo = utxo
continue
}
}
log.Warnf("No UTXO info found for index %d "+
"(prev_outpoint=%v), won't be able to sign "+
"for taproot output!", idx,