htlcs: remove origin_htlc_id from htlc_out.

This is a transient field, so rework things so we don't leave it in
struct htlc_out.  Instead, load htlc_in first and connect htlc_out to
them as we go.

This also changes one place where we use it instead of the am_origin
flag.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-12-12 10:09:10 +10:30
committed by Christian Decker
parent 345ca9b122
commit 12985331f7
11 changed files with 170 additions and 148 deletions

View File

@@ -28,6 +28,22 @@ struct htlc_in *find_htlc_in(const struct htlc_in_map *map,
return htlc_in_map_get(map, &key);
}
struct htlc_in *remove_htlc_in_by_dbid(struct htlc_in_map *remaining_htlcs_in,
u64 dbid)
{
struct htlc_in *hin;
struct htlc_in_map_iter ini;
for (hin = htlc_in_map_first(remaining_htlcs_in, &ini); hin;
hin = htlc_in_map_next(remaining_htlcs_in, &ini)) {
if (hin->dbid == dbid) {
htlc_in_map_del(remaining_htlcs_in, hin);
return hin;
}
}
return NULL;
}
static void destroy_htlc_in(struct htlc_in *hend, struct htlc_in_map *map)
{
htlc_in_map_del(map, hend);