core-lightning/plugins/bkpr/channel_event.h
niftynei 8039fde5ab bkpr: if we're missing info about an account, add in journal entry
There's two situations where we're missing info.

One is we get a 'channel_closed' event (but there's no 'channel_open')

The other is a balance_snapshot arrives with information about accounts
that doesn't match what's already on disk. (For some of these cases, we
may be missing 'channel_open' events..)

In the easy case (no channel_open missing), we just figure out what the
2022-07-28 12:08:18 +09:30

57 lines
1.3 KiB
C

#ifndef LIGHTNING_PLUGINS_BKPR_CHANNEL_EVENT_H
#define LIGHTNING_PLUGINS_BKPR_CHANNEL_EVENT_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <common/utils.h>
struct amount_msat;
struct sha256;
struct channel_event {
/* Id of this chain event in the database */
u64 db_id;
/* db_id of account this event belongs to */
u64 acct_db_id;
/* Name of the account this belongs to */
char *acct_name;
/* Tag describing the event */
const char *tag;
/* Amount we received in this event */
struct amount_msat credit;
/* Amount we paid in this event */
struct amount_msat debit;
/* Total 'fees' related to this channel event */
struct amount_msat fees;
/* What token are the credit/debits? */
const char *currency;
/* Payment identifier (typically the preimage hash) */
struct sha256 *payment_id;
/* Some payments share a payment_id, and are differentiable via id */
u32 part_id;
/* What time did the event happen */
u64 timestamp;
};
struct channel_event *new_channel_event(const tal_t *ctx,
const char *tag,
struct amount_msat credit,
struct amount_msat debit,
struct amount_msat fees,
const char *currency,
struct sha256 *payment_id STEALS,
u32 part_id,
u64 timestamp);
#endif /* LIGHTNING_PLUGINS_BKPR_CHANNEL_EVENT_H */