bkpr: if we're missing info about an account, add in journal entry

There's two situations where we're missing info.

One is we get a 'channel_closed' event (but there's no 'channel_open')

The other is a balance_snapshot arrives with information about accounts
that doesn't match what's already on disk. (For some of these cases, we
may be missing 'channel_open' events..)

In the easy case (no channel_open missing), we just figure out what the
This commit is contained in:
niftynei
2022-07-19 17:04:35 +09:30
committed by Rusty Russell
parent ccffac8208
commit 8039fde5ab
9 changed files with 559 additions and 101 deletions

View File

@@ -0,0 +1,30 @@
#include "config.h"
#include <ccan/crypto/sha256/sha256.h>
#include <ccan/tal/str/str.h>
#include <common/amount.h>
#include <plugins/bkpr/channel_event.h>
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 char *currency,
struct sha256 *payment_id STEALS,
u32 part_id,
u64 timestamp)
{
struct channel_event *ev = tal(ctx, struct channel_event);
ev->tag = tal_strdup(ev, tag);
ev->credit = credit;
ev->debit = debit;
ev->fees = fees;
ev->currency = tal_strdup(ev, currency);
ev->payment_id = tal_steal(ev, payment_id);
ev->part_id = part_id;
ev->timestamp = timestamp;
return ev;
}