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

Function json_mvt_id

lightningd/notification.c:444–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444static void json_mvt_id(struct json_stream *stream, enum mvt_type mvt_type,
445 struct mvt_id *id)
446{
447 switch (mvt_type) {
448 case CHAIN_MVT:
449 /* some 'journal entries' don't have a txid */
450 if (id->tx_txid)
451 json_add_string(stream, "txid",
452 type_to_string(tmpctx, struct bitcoin_txid,
453 id->tx_txid));
454 /* some chain ledger entries aren't associated with a utxo
455 * e.g. journal updates (due to penalty/state loss) and
456 * chain_fee entries */
457 if (id->outpoint) {
458 json_add_string(stream, "utxo_txid",
459 type_to_string(tmpctx, struct bitcoin_txid,
460 &id->outpoint->txid));
461 json_add_u32(stream, "vout", id->outpoint->n);
462 }
463
464 /* on-chain htlcs include a payment hash */
465 if (id->payment_hash)
466 json_add_sha256(stream, "payment_hash", id->payment_hash);
467 return;
468 case CHANNEL_MVT:
469 /* push funding / leases don't have a payment_hash */
470 if (id->payment_hash)
471 json_add_sha256(stream, "payment_hash", id->payment_hash);
472 if (id->part_id)
473 json_add_u64(stream, "part_id", *id->part_id);
474 return;
475 }
476 abort();
477}
478
479static void coin_movement_notification_serialize(struct json_stream *stream,
480 struct coin_mvt *mvt)

Callers 1

Calls 6

abortFunction · 0.85
json_add_stringFunction · 0.50
type_to_stringClass · 0.50
json_add_u32Function · 0.50
json_add_sha256Function · 0.50
json_add_u64Function · 0.50

Tested by

no test coverage detected