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

Function stack_number

bitcoin/script.c:134–146  ·  view source on GitHub ↗

Bitcoin script stack values are a special, special snowflake. * * They're little endian values, but 0 is an empty value. We only * handle single byte values here. */

Source from the content-addressed store, hash-verified

132 * They're little endian values, but 0 is an empty value. We only
133 * handle single byte values here. */
134static u8 *stack_number(const tal_t *ctx, unsigned int num)
135{
136 u8 val;
137
138 if (num == 0)
139 return tal_arr(ctx, u8, 0);
140
141 val = num;
142 assert(val == num);
143
144 /* We use tal_dup_arr since we want tal_count() to work */
145 return tal_dup_arr(ctx, u8, &val, 1, 0);
146}
147
148/* tal_count() gives the length of the script. */
149u8 *bitcoin_redeem_2of2(const tal_t *ctx,

Callers 3

bitcoin_witness_2of2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected