| 1353 | } |
| 1354 | |
| 1355 | static struct channel *wallet_channel_load(struct wallet *w, const u64 dbid) |
| 1356 | { |
| 1357 | struct peer *peer; |
| 1358 | struct channel *channel; |
| 1359 | |
| 1360 | /* We expect only one peer, but reuse same code */ |
| 1361 | if (!wallet_init_channels(w)) |
| 1362 | return NULL; |
| 1363 | peer = list_top(&w->ld->peers, struct peer, list); |
| 1364 | CHECK(peer); |
| 1365 | |
| 1366 | /* We load lots of identical dbid channels: use last one */ |
| 1367 | channel = list_tail(&peer->channels, struct channel, list); |
| 1368 | assert(channel->dbid == dbid); |
| 1369 | return channel; |
| 1370 | } |
| 1371 | |
| 1372 | static bool test_channel_crud(struct lightningd *ld, const tal_t *ctx) |
| 1373 | { |
no test coverage detected