| 61 | struct peer *peer); |
| 62 | |
| 63 | static struct subd *find_subd(struct peer *peer, |
| 64 | const struct channel_id *channel_id) |
| 65 | { |
| 66 | for (size_t i = 0; i < tal_count(peer->subds); i++) { |
| 67 | struct subd *subd = peer->subds[i]; |
| 68 | |
| 69 | /* Once we sent it tx_abort, we pretend it doesn't exist */ |
| 70 | if (subd->rcvd_tx_abort) |
| 71 | continue; |
| 72 | |
| 73 | /* Once we see a message using the real channel_id, we |
| 74 | * clear the temporary_channel_id */ |
| 75 | if (channel_id_eq(&subd->channel_id, channel_id)) { |
| 76 | subd->temporary_channel_id |
| 77 | = tal_free(subd->temporary_channel_id); |
| 78 | return subd; |
| 79 | } |
| 80 | if (subd->temporary_channel_id |
| 81 | && channel_id_eq(subd->temporary_channel_id, channel_id)) { |
| 82 | return subd; |
| 83 | } |
| 84 | } |
| 85 | return NULL; |
| 86 | } |
| 87 | |
| 88 | /* We try to send the final messages, but if buffer is full and they're |
| 89 | * not reading, we have to give up. */ |
no test coverage detected