Files
lightning/plugins/bkpr/onchain_fee.h
niftynei 899d54edd0 bkpr: have onchain_fee records be write-only, don't update in place
One really rough thing about how we did onchain fees is that the records update
every time a new event comes in.

The better way to do this is to create new entries for every adjustment,
so that reconciliation between printouts isn't a misery.

We add a timestamp and `update_count` to these records, so you can
roughly order them now (and have a good idea of the last time an event
that updated an onchain_fee occurred).
2022-07-28 12:08:18 +09:30

33 lines
703 B
C

#ifndef LIGHTNING_PLUGINS_BKPR_ONCHAIN_FEE_H
#define LIGHTNING_PLUGINS_BKPR_ONCHAIN_FEE_H
#include "config.h"
#include <ccan/short_types/short_types.h>
struct amount_msat;
struct bitcoin_txid;
struct onchain_fee {
/* db_id of account this event belongs to */
u64 acct_db_id;
/* Transaction that we're recording fees for */
struct bitcoin_txid txid;
/* Incremental change in onchain fees */
struct amount_msat credit;
struct amount_msat debit;
/* What token are fees? */
char *currency;
/* Timestamp of the event that created this fee update */
u64 timestamp;
/* Count of records we've recorded for this tx */
u32 update_count;
};
#endif /* LIGHTNING_PLUGINS_BKPR_ONCHAIN_FEE_H */