2020-03-18 18:35:59 -05:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_COIN_MVTS_H
|
|
|
|
|
#define LIGHTNING_LIGHTNINGD_COIN_MVTS_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
#include <common/coin_mvt.h>
|
2022-01-03 12:47:46 -06:00
|
|
|
|
2025-08-19 10:30:52 +09:30
|
|
|
struct htlc_in;
|
|
|
|
|
struct htlc_out;
|
|
|
|
|
struct json_stream;
|
2022-01-03 12:47:46 -06:00
|
|
|
struct lightningd;
|
2020-03-18 18:35:59 -05:00
|
|
|
|
2021-12-13 16:44:32 -06:00
|
|
|
struct account_balance {
|
|
|
|
|
const char *acct_id;
|
|
|
|
|
const char *bip173_name;
|
|
|
|
|
struct amount_msat balance;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct balance_snapshot {
|
|
|
|
|
struct node_id *node_id;
|
|
|
|
|
u32 blockheight;
|
|
|
|
|
u32 timestamp;
|
|
|
|
|
|
|
|
|
|
struct account_balance **accts;
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-14 14:01:18 -05:00
|
|
|
struct channel_coin_mvt *new_channel_mvt_invoice_hin(const tal_t *ctx,
|
2025-08-14 10:57:53 +09:30
|
|
|
const struct htlc_in *hin,
|
|
|
|
|
const struct channel *channel);
|
2020-04-14 14:01:18 -05:00
|
|
|
struct channel_coin_mvt *new_channel_mvt_routed_hin(const tal_t *ctx,
|
2025-08-14 10:57:53 +09:30
|
|
|
const struct htlc_in *hin,
|
|
|
|
|
const struct channel *channel);
|
2020-04-14 14:01:18 -05:00
|
|
|
struct channel_coin_mvt *new_channel_mvt_invoice_hout(const tal_t *ctx,
|
2025-08-14 10:57:53 +09:30
|
|
|
const struct htlc_out *hout,
|
|
|
|
|
const struct channel *channel);
|
2020-04-14 14:01:18 -05:00
|
|
|
struct channel_coin_mvt *new_channel_mvt_routed_hout(const tal_t *ctx,
|
2025-08-14 10:57:53 +09:30
|
|
|
const struct htlc_out *hout,
|
|
|
|
|
const struct channel *channel);
|
2025-08-14 17:19:44 +09:30
|
|
|
struct channel_coin_mvt *new_channel_mvt_penalty_adj(const tal_t *ctx,
|
|
|
|
|
const struct channel *channel,
|
|
|
|
|
struct amount_msat amount,
|
|
|
|
|
enum coin_mvt_dir direction);
|
2020-04-14 14:01:18 -05:00
|
|
|
|
2025-05-15 15:17:49 +09:30
|
|
|
void send_account_balance_snapshot(struct lightningd *ld);
|
2025-08-14 10:57:55 +09:30
|
|
|
|
|
|
|
|
/* Shared by listcoinmoves and notifications code */
|
|
|
|
|
void json_add_chain_mvt_fields(struct json_stream *stream,
|
|
|
|
|
bool include_tags_arr,
|
|
|
|
|
bool include_old_utxo_fields,
|
|
|
|
|
bool include_old_txid_field,
|
2025-08-19 10:30:46 +09:30
|
|
|
const struct chain_coin_mvt *chain_mvt,
|
|
|
|
|
u64 id);
|
2025-08-14 10:57:55 +09:30
|
|
|
void json_add_channel_mvt_fields(struct json_stream *stream,
|
|
|
|
|
bool include_tags_arr,
|
|
|
|
|
const struct channel_coin_mvt *chan_mvt,
|
2025-08-19 10:30:46 +09:30
|
|
|
u64 id,
|
2025-08-14 10:57:55 +09:30
|
|
|
bool extra_tags_field);
|
2025-08-19 10:30:46 +09:30
|
|
|
|
|
|
|
|
/* For db code to get incremental ids */
|
|
|
|
|
u64 chain_mvt_index_created(struct lightningd *ld,
|
2025-08-19 10:30:52 +09:30
|
|
|
struct db *db,
|
2025-08-19 10:30:46 +09:30
|
|
|
const struct mvt_account_id *account,
|
|
|
|
|
struct amount_msat credit,
|
|
|
|
|
struct amount_msat debit);
|
|
|
|
|
|
|
|
|
|
u64 channel_mvt_index_created(struct lightningd *ld,
|
2025-08-19 10:30:52 +09:30
|
|
|
struct db *db,
|
2025-08-19 10:30:46 +09:30
|
|
|
const struct mvt_account_id *account,
|
|
|
|
|
struct amount_msat credit,
|
|
|
|
|
struct amount_msat debit);
|
2020-03-18 18:35:59 -05:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_COIN_MVTS_H */
|