pub fn validate_p2pkh(
script_sig: &[u8],
script_pubkey: &[u8],
) -> Result<bool, ScriptError>Expand description
Validates a Pay-to-Public-Key-Hash (P2PKH) script pair.
Executes script_sig (the unlocking script) on a fresh stack, then
executes script_pubkey (the locking script) on the resulting stack.
This two-phase model matches Bitcoin’s actual execution behavior
(post-2010), preventing scriptSig from manipulating scriptPubKey’s
control flow.
Returns Ok(true) if the combined execution succeeds (top stack
element is truthy after both phases).
OP_CHECKSIG uses stub mode (always succeeds). For real ECDSA
verification, use validate_p2pkh_with_opts with a sighash and
the secp256k1 feature enabled.
Both arguments are raw script bytes (not hex). Use
crate::hex::decode_hex to convert hex strings first.