core-lightning/plugins/bkpr/account.c
niftynei 8039fde5ab 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
2022-07-28 12:08:18 +09:30

30 lines
677 B
C

#include "config.h"
#include <ccan/str/str.h>
#include <common/coin_mvt.h>
#include <common/node_id.h>
#include <plugins/bkpr/account.h>
struct account *new_account(const tal_t *ctx,
const char *name STEALS,
struct node_id *peer_id)
{
struct account *a = tal(ctx, struct account);
a->name = tal_steal(a, name);
a->peer_id = peer_id;
a->is_wallet = streq(a->name, WALLET);
a->we_opened = false;
a->leased = false;
a->onchain_resolved_block = 0;
a->open_event_db_id = NULL;
a->closed_event_db_id = NULL;
return a;
}
bool is_channel_account(const struct account *acct)
{
return !streq(acct->name, WALLET)
&& !streq(acct->name, "external");
}