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

Function towire_utxo

common/utxo.c:5–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <wire/wire.h>
4
5void towire_utxo(u8 **pptr, const struct utxo *utxo)
6{
7 /* Is this a unilateral close output and needs the
8 * close_info? */
9 bool is_unilateral_close = utxo->close_info != NULL;
10 towire_bitcoin_outpoint(pptr, &utxo->outpoint);
11 towire_amount_sat(pptr, utxo->amount);
12 towire_u32(pptr, utxo->keyindex);
13 towire_bool(pptr, utxo->is_p2sh);
14
15 towire_u16(pptr, tal_count(utxo->scriptPubkey));
16 towire_u8_array(pptr, utxo->scriptPubkey, tal_count(utxo->scriptPubkey));
17
18 towire_bool(pptr, is_unilateral_close);
19 if (is_unilateral_close) {
20 towire_u64(pptr, utxo->close_info->channel_id);
21 towire_node_id(pptr, &utxo->close_info->peer_id);
22 towire_bool(pptr, utxo->close_info->commitment_point != NULL);
23 if (utxo->close_info->commitment_point)
24 towire_pubkey(pptr, utxo->close_info->commitment_point);
25 towire_bool(pptr, utxo->close_info->option_anchor_outputs);
26 towire_u32(pptr, utxo->close_info->csv);
27 }
28}
29
30struct utxo *fromwire_utxo(const tal_t *ctx, const u8 **ptr, size_t *max)
31{

Callers

nothing calls this directly

Calls 9

towire_bitcoin_outpointFunction · 0.85
towire_pubkeyFunction · 0.85
towire_amount_satFunction · 0.70
towire_node_idFunction · 0.70
towire_u32Function · 0.50
towire_boolFunction · 0.50
towire_u16Function · 0.50
towire_u8_arrayFunction · 0.50
towire_u64Function · 0.50

Tested by

no test coverage detected