| 1016 | } |
| 1017 | |
| 1018 | static 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 */ |
| 1058 | static char *fetch_out_desc_invstr(const tal_t *ctx, const char *buf, |
no test coverage detected