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

Function valid_shutdown_scriptpubkey

common/shutdown_scriptpubkey.c:75–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool valid_shutdown_scriptpubkey(const u8 *scriptpubkey,
76 bool anysegwit,
77 bool allow_oldstyle,
78 bool option_simple_close)
79{
80 const size_t script_len = tal_bytelen(scriptpubkey);
81 if (allow_oldstyle) {
82 if (is_p2pkh(scriptpubkey, script_len, NULL)
83 || is_p2sh(scriptpubkey, script_len, NULL))
84 return true;
85 }
86
87 return is_p2wpkh(scriptpubkey, script_len, NULL)
88 || is_p2wsh(scriptpubkey, script_len, NULL)
89 || (anysegwit && is_valid_witnessprog(scriptpubkey, script_len))
90 || (option_simple_close && is_valid_op_return(scriptpubkey, script_len));
91}

Callers 4

json_closeFunction · 0.85
peer_got_shutdownFunction · 0.85

Calls 7

tal_bytelenFunction · 0.85
is_p2wpkhFunction · 0.85
is_p2wshFunction · 0.85
is_valid_witnessprogFunction · 0.85
is_valid_op_returnFunction · 0.85
is_p2pkhFunction · 0.50
is_p2shFunction · 0.50

Tested by

no test coverage detected