| 442 | } |
| 443 | |
| 444 | static 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 | |
| 479 | static void coin_movement_notification_serialize(struct json_stream *stream, |
| 480 | struct coin_mvt *mvt) |
no test coverage detected