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

Function balance_snapshot_serialize

lightningd/notification.c:526–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526static void balance_snapshot_serialize(struct json_stream *stream,
527 const struct balance_snapshot *snap)
528{
529 json_add_node_id(stream, "node_id", snap->node_id);
530 json_add_u32(stream, "blockheight", snap->blockheight);
531 json_add_u32(stream, "timestamp", snap->timestamp);
532
533 json_array_start(stream, "accounts");
534 for (size_t i = 0; i < tal_count(snap->accts); i++) {
535 json_object_start(stream, NULL);
536 json_add_string(stream, "account_id",
537 snap->accts[i]->acct_id);
538 json_add_amount_msat(stream, "balance_msat",
539 snap->accts[i]->balance);
540 json_add_string(stream, "coin_type", snap->accts[i]->bip173_name);
541 json_object_end(stream);
542 }
543 json_array_end(stream);
544}
545
546REGISTER_NOTIFICATION(balance_snapshot);
547

Callers 1

notify_balance_snapshotFunction · 0.85

Calls 8

json_add_node_idFunction · 0.85
json_add_u32Function · 0.85
json_array_startFunction · 0.85
json_object_startFunction · 0.85
json_add_amount_msatFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85
json_add_stringFunction · 0.50

Tested by

no test coverage detected