-
-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
There is a part of code in the signIdx function that searches for the public key of the signer in the witnessScript and throws an error if the public key is not found:
else {
// only compressed keys are supported for now
const pubKey = u.pubECDSA(privateKey);
// TODO: replace with explicit checks
// Check if script has public key or its has inside
let hasPubkey = false;
const pubKeyHash = u.hash160(pubKey);
for (const i of Script.decode(inputType.lastScript)) {
if (isBytes(i) && (P.equalBytes(i, pubKey) || P.equalBytes(i, pubKeyHash)))
hasPubkey = true;
}
if (!hasPubkey) throw new Error(`Input script doesn't have pubKey: ${inputType.lastScript}`);Is this check really necessary? I have a witnessScript that only contains addresses and opcodes. The subscripts are standard PayToAddr subscripts, so there are no public keys in them.
Would it be possible to have this check removed, since it prevents the signing process for no good reason?
For context my input is a wsh-unknown type. Since the unknown type script can be arbitrary, I don't see a reason why it has to contain the public key of the signer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels