| 91 | } |
| 92 | |
| 93 | static struct account *fromwire_account(struct accounts *accounts, |
| 94 | const u8 **pptr, size_t *max) |
| 95 | { |
| 96 | const char *name; |
| 97 | struct account *account; |
| 98 | |
| 99 | name = fromwire_wirestring(NULL, pptr, max); |
| 100 | if (!name) |
| 101 | return NULL; |
| 102 | |
| 103 | account = new_account(accounts, take(name)); |
| 104 | if (fromwire_bool(pptr, max)) { |
| 105 | account->peer_id = tal(account, struct node_id); |
| 106 | fromwire_node_id(pptr, max, account->peer_id); |
| 107 | } else |
| 108 | account->peer_id = NULL; |
| 109 | account->we_opened = fromwire_bool(pptr, max); |
| 110 | account->leased = fromwire_bool(pptr, max); |
| 111 | account->onchain_resolved_block = fromwire_u64(pptr, max); |
| 112 | if (fromwire_bool(pptr, max)) { |
| 113 | account->open_event_db_id = tal(account, u64); |
| 114 | *account->open_event_db_id = fromwire_u64(pptr, max); |
| 115 | } else |
| 116 | account->open_event_db_id = NULL; |
| 117 | if (fromwire_bool(pptr, max)) { |
| 118 | account->closed_event_db_id = tal(account, u64); |
| 119 | *account->closed_event_db_id = fromwire_u64(pptr, max); |
| 120 | } else |
| 121 | account->closed_event_db_id = NULL; |
| 122 | account->closed_count = fromwire_u32(pptr, max); |
| 123 | |
| 124 | if (!pptr) |
| 125 | return tal_free(account); |
| 126 | return account; |
| 127 | } |
| 128 | |
| 129 | struct account **list_accounts(const tal_t *ctx, const struct bkpr *bkpr) |
| 130 | { |
no test coverage detected