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

Function scriptpubkey_p2pkh

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

Create an output script using p2pkh */

Source from the content-addressed store, hash-verified

186
187/* Create an output script using p2pkh */
188u8 *scriptpubkey_p2pkh(const tal_t *ctx, const struct bitcoin_address *addr)
189{
190 u8 *script = tal_arr(ctx, u8, 0);
191
192 add_op(&script, OP_DUP);
193 add_op(&script, OP_HASH160);
194 script_push_bytes(&script, &addr->addr, sizeof(addr->addr));
195 add_op(&script, OP_EQUALVERIFY);
196 add_op(&script, OP_CHECKSIG);
197 assert(tal_count(script) == BITCOIN_SCRIPTPUBKEY_P2PKH_LEN);
198 return script;
199}
200
201/* Create an input script which spends p2pkh */
202u8 *bitcoin_redeem_p2pkh(const tal_t *ctx, const struct pubkey *pubkey,

Callers 3

decode_fFunction · 0.85

Calls 2

add_opFunction · 0.85
script_push_bytesFunction · 0.85

Tested by

no test coverage detected