| 47 | } |
| 48 | |
| 49 | static struct account *new_account(struct accounts *accounts, |
| 50 | const char *name TAKES) |
| 51 | { |
| 52 | struct account *a = tal(accounts, struct account); |
| 53 | |
| 54 | a->name = tal_strdup(a, name); |
| 55 | a->peer_id = NULL; |
| 56 | a->is_wallet = is_wallet_account(a->name); |
| 57 | a->we_opened = false; |
| 58 | a->leased = false; |
| 59 | a->onchain_resolved_block = 0; |
| 60 | a->open_event_db_id = NULL; |
| 61 | a->closed_event_db_id = NULL; |
| 62 | a->closed_count = 0; |
| 63 | |
| 64 | account_htable_add(accounts->htable, a); |
| 65 | tal_add_destructor2(a, destroy_account, accounts); |
| 66 | return a; |
| 67 | } |
| 68 | |
| 69 | static void towire_account(u8 **pptr, const struct account *account) |
| 70 | { |