extract_script_pub_key_address

Function extract_script_pub_key_address 

Source
pub fn extract_script_pub_key_address(
    script_public_key: &ScriptPublicKey,
    prefix: Prefix,
) -> Result<Address, TxScriptError>
Expand description

Returns the address encoded in a script public key.

Notes:

  • This function only works for ‘standard’ transaction script types. Any data such as public keys which are invalid will return the TxScriptError::PubKeyFormat error.

  • In case a ScriptClass is needed by the caller, call ScriptClass::from(address.version) or use address.version directly instead, where address is the successfully returned address.