MCPcopy Create free account
hub / github.com/ElementsProject/lightning / is_p2pkh

Function is_p2pkh

bitcoin/script.c:478–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478bool is_p2pkh(const u8 *script, size_t script_len, struct bitcoin_address *addr)
479{
480 if (script_len != BITCOIN_SCRIPTPUBKEY_P2PKH_LEN)
481 return false;
482 if (script[0] != OP_DUP)
483 return false;
484 if (script[1] != OP_HASH160)
485 return false;
486 if (script[2] != OP_PUSHBYTES(20))
487 return false;
488 if (script[23] != OP_EQUALVERIFY)
489 return false;
490 if (script[24] != OP_CHECKSIG)
491 return false;
492 if (addr)
493 memcpy(addr, script+3, 20);
494 return true;
495}
496
497bool is_p2sh(const u8 *script, size_t script_len, struct ripemd160 *addr)
498{

Callers 2

is_known_scripttypeFunction · 0.70
mainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected