MCPcopy Create free account
hub / github.com/ElementsProject/lightning / do_account_close_checks

Function do_account_close_checks

plugins/bkpr/bookkeeper.c:1018–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016}
1017
1018static char *do_account_close_checks(struct command *cmd,
1019 struct bkpr *bkpr,
1020 struct chain_event *e,
1021 struct account *acct)
1022{
1023 struct account *closed_acct;
1024
1025 /* If is an external acct event, might be close channel related */
1026 if (!is_channel_account(acct->name) && e->origin_acct) {
1027 closed_acct = find_account(bkpr, e->origin_acct);
1028 } else if (!is_channel_account(acct->name) && !e->spending_txid) {
1029 const char *acctname;
1030
1031 acctname = find_close_account_name(tmpctx, bkpr, cmd, &e->outpoint.txid);
1032 if (acctname) {
1033 closed_acct = find_account(bkpr, acctname);
1034 } else {
1035 closed_acct = NULL;
1036 }
1037 } else
1038 /* Get most up to date account entry */
1039 closed_acct = find_account(bkpr, acct->name);
1040
1041
1042 if (closed_acct && closed_acct->closed_event_db_id) {
1043 u64 closeheight = account_onchain_closeheight(bkpr, cmd, closed_acct);
1044 if (closeheight != 0) {
1045 char *err;
1046 account_update_closeheight(cmd, closed_acct, closeheight);
1047 err = update_channel_onchain_fees(cmd, cmd, bkpr, closed_acct);
1048 if (err) {
1049 return err;
1050 }
1051 }
1052 }
1053
1054 return NULL;
1055}
1056
1057/* Returns true if "fatal" error, otherwise just a normal error */
1058static char *fetch_out_desc_invstr(const tal_t *ctx, const char *buf,

Callers 1

parse_and_log_chain_moveFunction · 0.85

Calls 6

is_channel_accountFunction · 0.85
find_accountFunction · 0.70
find_close_account_nameFunction · 0.70

Tested by

no test coverage detected