Files
palladum-lightning/plugins/bkpr/chain_event.h
Rusty Russell af2e403490 bkpr: use the in-memory event descriptions, not the database ones.
The new access APIs are more symmetrical:

1. edit_utxo_description -> add_utxo_description
2. add_payment_hash_desc -> add_payment_hash_description

And to read it, instead of accessing ->ev_desc (now removed) we use
chain_event_description() & channel_event_description(), threading bkpr though
as needed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-19 13:37:50 +09:30

69 lines
1.5 KiB
C

#ifndef LIGHTNING_PLUGINS_BKPR_CHAIN_EVENT_H
#define LIGHTNING_PLUGINS_BKPR_CHAIN_EVENT_H
#include "config.h"
#include <bitcoin/tx.h>
#include <ccan/short_types/short_types.h>
struct amount_msat;
struct bkpr;
struct bitcoin_outpoint;
struct bitcoin_txid;
struct json_stream;
struct chain_event {
/* Id of this chain event in the database */
u64 db_id;
/* Name of the account this belongs to */
const char *acct_name;
/* Name of account this originated from */
const char *origin_acct;
/* Tag describing the event */
const char *tag;
/* Is this chain output stealable? If so
* we'll need to watch it for longer */
bool stealable;
/* Is this chain event because of a splice
* confirmation? */
bool splice_close;
/* Is this a rebalance event? */
bool rebalance;
/* Amount we received in this event */
struct amount_msat credit;
/* Amount we paid in this event */
struct amount_msat debit;
/* Total 'amount' of output on this chain event */
struct amount_msat output_value;
/* What time did the event happen */
u64 timestamp;
/* What block did the event happen */
u32 blockheight;
/* What txo did this event concern */
struct bitcoin_outpoint outpoint;
/* What tx was the outpoint spent in (if spent) */
struct bitcoin_txid *spending_txid;
/* Sometimes chain events resolve payments */
struct sha256 *payment_id;
};
void json_add_chain_event(struct json_stream *out,
const struct bkpr *bkpr,
struct chain_event *ev);
#endif /* LIGHTNING_PLUGINS_BKPR_CHAIN_EVENT_H */