mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
rpcwallet: disallow empty UTXO pk script [skip ci]
If we're signing for an UTXO that isn't known to the wallet, then the UTXO's pk script _must_ be set in the sign descriptor. Otherwise we run into a generic PSBT serialization error when running in a remote signing setup.
This commit is contained in:
parent
04bbbea9a7
commit
75016a176c
@ -618,6 +618,16 @@ func (r *RPCKeyRing) remoteSign(tx *wire.MsgTx, signDesc *input.SignDescriptor,
|
||||
PubKey: signDesc.KeyDesc.PubKey.SerializeCompressed(),
|
||||
}}
|
||||
|
||||
// We need to specify a pk script in the witness UTXO, otherwise
|
||||
// the field becomes invalid when serialized as a PSBT. To avoid
|
||||
// running into a generic "Invalid PSBT serialization format"
|
||||
// error later, we return a more descriptive error now.
|
||||
if len(in.WitnessUtxo.PkScript) == 0 {
|
||||
return nil, fmt.Errorf("error assembling UTXO " +
|
||||
"information, output not known to wallet and " +
|
||||
"no UTXO pk script provided in sign descriptor")
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("error assembling UTXO information, "+
|
||||
"wallet returned err='%v' and sign descriptor is "+
|
||||
|
Loading…
Reference in New Issue
Block a user