#ifndef LIGHTNING_PLUGINS_BKPR_RECORDER_H
#define LIGHTNING_PLUGINS_BKPR_RECORDER_H
#include "config.h"
#include <ccan/tal/tal.h>
struct account;
struct bitcoin_txid;
struct chain_event;
struct channel_event;
struct plugin;
enum mvt_tag;
struct onchain_fee;
#define SQLITE_MAX_UINT 0x7FFFFFFFFFFFFFFF
struct fee_sum {
const char *acct_name;
struct bitcoin_txid *txid;
struct amount_msat fees_paid;
u64 last_timestamp;
};
struct txo_pair {
struct chain_event *txo;
struct chain_event *spend;
};
struct txo_set {
struct bitcoin_txid *txid;
struct txo_pair **pairs;
};
struct channel_event **account_get_channel_events(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
struct account *acct);
struct channel_event **get_channel_events_by_id(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
const struct sha256 *id);
struct channel_event **list_channel_events(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd);
struct channel_event **list_channel_events_timebox(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
u64 start_time,
u64 end_time);
struct chain_event **account_get_chain_events(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
struct account *acct);
struct chain_event **find_chain_events_bytxid(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
const struct bitcoin_txid *txid);
struct chain_event **list_chain_events(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd);
struct chain_event **list_chain_events_timebox(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
u64 start_time,
u64 end_time);
struct chain_event **get_chain_events_by_id(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
const struct sha256 *id);
struct chain_event **get_chain_events_by_outpoint(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
const struct bitcoin_outpoint *outpoint);
bool account_get_credit_debit(const struct bkpr *bkpr,
struct command *cmd,
const char *acct_name,
struct amount_msat *credit,
struct amount_msat *debit);
struct chain_event *find_chain_event_by_id(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
u64 event_db_id);
bool find_txo_chain(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
const struct account *acct,
struct txo_set ***sets);
const char *find_close_account_name(const tal_t *ctx,
const struct bkpr *bkpr,
struct command *cmd,
const struct bitcoin_txid *txid);
u64 account_onchain_closeheight(const struct bkpr *bkpr,
struct command *cmd,
const struct account *acct);
void maybe_closeout_external_deposits(struct command *cmd,
struct bkpr *bkpr,
const struct bitcoin_txid *txid,
u32 blockheight);
void maybe_record_rebalance(struct command *cmd,
struct bkpr *bkpr,
const struct channel_event *out);
#endif