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

Function fromwire_utxo

common/utxo.c:30–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30struct utxo *fromwire_utxo(const tal_t *ctx, const u8 **ptr, size_t *max)
31{
32 struct utxo *utxo = tal(ctx, struct utxo);
33
34 fromwire_bitcoin_outpoint(ptr, max, &utxo->outpoint);
35 utxo->amount = fromwire_amount_sat(ptr, max);
36 utxo->keyindex = fromwire_u32(ptr, max);
37 utxo->is_p2sh = fromwire_bool(ptr, max);
38
39 utxo->scriptPubkey = fromwire_tal_arrn(utxo, ptr, max, fromwire_u16(ptr, max));
40
41 if (fromwire_bool(ptr, max)) {
42 utxo->close_info = tal(utxo, struct unilateral_close_info);
43 utxo->close_info->channel_id = fromwire_u64(ptr, max);
44 fromwire_node_id(ptr, max, &utxo->close_info->peer_id);
45 if (fromwire_bool(ptr, max)) {
46 utxo->close_info->commitment_point = tal(utxo,
47 struct pubkey);
48 fromwire_pubkey(ptr, max,
49 utxo->close_info->commitment_point);
50 } else
51 utxo->close_info->commitment_point = NULL;
52 utxo->close_info->option_anchor_outputs
53 = fromwire_bool(ptr, max);
54 utxo->close_info->csv = fromwire_u32(ptr, max);
55 } else {
56 utxo->close_info = NULL;
57 }
58 return utxo;
59}
60
61size_t utxo_spend_weight(const struct utxo *utxo, size_t min_witness_weight)
62{

Callers

nothing calls this directly

Calls 9

fromwire_pubkeyFunction · 0.85
fromwire_amount_satFunction · 0.70
fromwire_node_idFunction · 0.70
fromwire_u32Function · 0.50
fromwire_boolFunction · 0.50
fromwire_tal_arrnFunction · 0.50
fromwire_u16Function · 0.50
fromwire_u64Function · 0.50

Tested by

no test coverage detected