Files
palladum-lightning/plugins/bkpr/channel_event.h
Rusty Russell 2a191479a3 bkpr: take, don't steal in new_channel_event.
Cleaner (I'm about to hand it a sha256 on the stack).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-19 13:37:50 +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 bkpr;
struct json_stream;
struct sha256;
struct channel_event {
/* Id of this chain event in the database */
u64 db_id;
/* Name of the account this belongs to */
const 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;
/* 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 struct sha256 *payment_id TAKES,
u32 part_id,
u64 timestamp);
void json_add_channel_event(struct json_stream *out,
const struct bkpr *bkpr,
struct channel_event *ev);
#endif /* LIGHTNING_PLUGINS_BKPR_CHANNEL_EVENT_H */