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

Function is_p2sh

bitcoin/script.c:497–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497bool is_p2sh(const u8 *script, size_t script_len, struct ripemd160 *addr)
498{
499 if (script_len != BITCOIN_SCRIPTPUBKEY_P2SH_LEN)
500 return false;
501 if (script[0] != OP_HASH160)
502 return false;
503 if (script[1] != OP_PUSHBYTES(20))
504 return false;
505 if (script[22] != OP_EQUAL)
506 return false;
507 if (addr)
508 memcpy(addr, script+2, 20);
509 return true;
510}
511
512bool is_p2wsh(const u8 *script, size_t script_len, struct sha256 *addr)
513{

Callers 2

is_known_scripttypeFunction · 0.70
mainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected