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

Function scriptpubkey_p2pkh

bitcoin/script.c:177–188  ·  view source on GitHub ↗

Create an output script using p2pkh */

Source from the content-addressed store, hash-verified

175
176/* Create an output script using p2pkh */
177u8 *scriptpubkey_p2pkh(const tal_t *ctx, const struct bitcoin_address *addr)
178{
179 u8 *script = tal_arr(ctx, u8, 0);
180
181 add_op(&script, OP_DUP);
182 add_op(&script, OP_HASH160);
183 script_push_bytes(&script, &addr->addr, sizeof(addr->addr));
184 add_op(&script, OP_EQUALVERIFY);
185 add_op(&script, OP_CHECKSIG);
186 assert(tal_count(script) == BITCOIN_SCRIPTPUBKEY_P2PKH_LEN);
187 return script;
188}
189
190u8 *scriptpubkey_opreturn_padded(const tal_t *ctx)
191{

Callers 2

decode_fFunction · 0.85

Calls 2

add_opFunction · 0.85
script_push_bytesFunction · 0.70

Tested by

no test coverage detected