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

Function json_add_chain_event

plugins/bkpr/chain_event.c:6–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <plugins/bkpr/chain_event.h>
5
6void json_add_chain_event(struct json_stream *out, struct chain_event *ev)
7{
8 json_object_start(out, NULL);
9 json_add_string(out, "account", ev->acct_name);
10 if (ev->origin_acct)
11 json_add_string(out, "origin", ev->origin_acct);
12 json_add_string(out, "type", "chain");
13 json_add_string(out, "tag", ev->tag);
14 json_add_amount_msat_only(out, "credit_msat", ev->credit);
15 json_add_amount_msat_only(out, "debit_msat", ev->debit);
16 json_add_string(out, "currency", ev->currency);
17 json_add_outpoint(out, "outpoint", &ev->outpoint);
18
19 if (ev->spending_txid)
20 json_add_txid(out, "txid", ev->spending_txid);
21 if (ev->payment_id)
22 json_add_sha256(out, "payment_id", ev->payment_id);
23 json_add_u64(out, "timestamp", ev->timestamp);
24 json_add_u32(out, "blockheight", ev->blockheight);
25 if (ev->desc)
26 json_add_string(out, "description", ev->desc);
27 json_object_end(out);
28}

Callers 1

json_list_account_eventsFunction · 0.85

Calls 9

json_add_outpointFunction · 0.85
json_object_startFunction · 0.50
json_add_stringFunction · 0.50
json_add_txidFunction · 0.50
json_add_sha256Function · 0.50
json_add_u64Function · 0.50
json_add_u32Function · 0.50
json_object_endFunction · 0.50

Tested by

no test coverage detected