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

Function is_p2sh

bitcoin/script.c:437–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437bool is_p2sh(const u8 *script, struct ripemd160 *addr)
438{
439 size_t script_len = tal_count(script);
440
441 if (script_len != BITCOIN_SCRIPTPUBKEY_P2SH_LEN)
442 return false;
443 if (script[0] != OP_HASH160)
444 return false;
445 if (script[1] != OP_PUSHBYTES(20))
446 return false;
447 if (script[22] != OP_EQUAL)
448 return false;
449 if (addr)
450 memcpy(addr, script+2, 20);
451 return true;
452}
453
454bool is_p2wsh(const u8 *script, struct sha256 *addr)
455{

Callers 3

is_known_scripttypeFunction · 0.70
wallet_can_spendFunction · 0.50
mainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected