| 32 | } |
| 33 | |
| 34 | static struct income_event *chain_to_income(const tal_t *ctx, |
| 35 | struct chain_event *ev, |
| 36 | char *acct_to_attribute, |
| 37 | struct amount_msat credit, |
| 38 | struct amount_msat debit) |
| 39 | { |
| 40 | struct income_event *inc = tal(ctx, struct income_event); |
| 41 | |
| 42 | inc->acct_name = tal_strdup(inc, acct_to_attribute); |
| 43 | inc->tag = tal_strdup(inc, ev->tag); |
| 44 | inc->credit = credit; |
| 45 | inc->debit = debit; |
| 46 | inc->fees = AMOUNT_MSAT(0); |
| 47 | inc->currency = tal_strdup(inc, ev->currency); |
| 48 | inc->timestamp = ev->timestamp; |
| 49 | inc->outpoint = tal_dup(inc, struct bitcoin_outpoint, &ev->outpoint); |
| 50 | |
| 51 | if (ev->desc) |
| 52 | inc->desc = tal_strdup(inc, ev->desc); |
| 53 | else |
| 54 | inc->desc = NULL; |
| 55 | |
| 56 | inc->txid = tal_dup_or_null(inc, struct bitcoin_txid, ev->spending_txid); |
| 57 | inc->payment_id = tal_dup_or_null(inc, struct sha256, ev->payment_id); |
| 58 | |
| 59 | return inc; |
| 60 | } |
| 61 | |
| 62 | static struct income_event *channel_to_income(const tal_t *ctx, |
| 63 | struct channel_event *ev, |
no outgoing calls
no test coverage detected