| 679 | } |
| 680 | |
| 681 | static void harmony_entry(const tal_t *ctx, FILE *csvf, struct income_event *ev) |
| 682 | { |
| 683 | time_t tv; |
| 684 | tv = ev->timestamp; |
| 685 | /* datefmt: ISO-8601 */ |
| 686 | char timebuf[sizeof("yyyy-mm-ddTHH:MM:SSZ")]; |
| 687 | strftime(timebuf, sizeof(timebuf), "%Y-%m-%dT%TZ", gmtime(&tv)); |
| 688 | |
| 689 | /* New line! */ |
| 690 | fprintf(csvf, "\n"); |
| 691 | |
| 692 | fprintf(csvf, "%s", timebuf); |
| 693 | fprintf(csvf, ","); |
| 694 | |
| 695 | /* ",Venue" */ |
| 696 | /* FIXME: use node_id ? */ |
| 697 | fprintf(csvf, "cln"); |
| 698 | fprintf(csvf, ","); |
| 699 | |
| 700 | /* ",Type" */ |
| 701 | fprintf(csvf, "%s", income_event_harmony_type(ev)); |
| 702 | fprintf(csvf, ","); |
| 703 | |
| 704 | /* ",Amount" */ |
| 705 | if (!amount_msat_is_zero(ev->debit)) { |
| 706 | /* Debits are negative */ |
| 707 | fprintf(csvf, "-"); |
| 708 | fprintf(csvf, "%s", |
| 709 | fmt_amount_msat_btc(ctx, ev->debit, false)); |
| 710 | } else |
| 711 | fprintf(csvf, "%s", |
| 712 | fmt_amount_msat_btc(ctx, ev->credit, false)); |
| 713 | |
| 714 | fprintf(csvf, ","); |
| 715 | |
| 716 | /* ",Asset" */ |
| 717 | fprintf(csvf, "%s", asset_type_name()); |
| 718 | fprintf(csvf, ","); |
| 719 | |
| 720 | /* ",Transaction ID" */ |
| 721 | /* Some of this data is duplicated in other fields. |
| 722 | * We don't have a standard 'txid' for every event though */ |
| 723 | if (ev->txid) |
| 724 | fprintf(csvf, "%s", |
| 725 | fmt_bitcoin_txid(ctx, ev->txid)); |
| 726 | else if (ev->payment_id) |
| 727 | fprintf(csvf, "%s", |
| 728 | fmt_sha256(ctx, ev->payment_id)); |
| 729 | else if (ev->outpoint) |
| 730 | fprintf(csvf, "%s", |
| 731 | fmt_bitcoin_outpoint(ctx, ev->outpoint)); |
| 732 | fprintf(csvf, ","); |
| 733 | |
| 734 | /* ",Order ID" payment hash, if any */ |
| 735 | if (ev->payment_id) |
| 736 | fprintf(csvf, "%s", |
| 737 | fmt_sha256(ctx, ev->payment_id)); |
| 738 | fprintf(csvf, ","); |
nothing calls this directly
no test coverage detected