Skip to content

Commit 57b4471

Browse files
committed
[WIP] bugfix
Signed-off-by: Lagrang3 <[email protected]>
1 parent 990e5fe commit 57b4471

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

plugins/askrene/refine.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,20 @@ const char *refine_with_fees_and_limits(const tal_t *ctx,
420420
tal_arr_remove(&flows_index, i);
421421
}
422422

423-
tal_free(working_ctx);
423+
/* finally write the remaining flows */
424+
struct flow **tmp_flows = tal_arr(working_ctx, struct flow *, 0);
425+
for (size_t i = 0; i < tal_count(flows_index); i++) {
426+
tal_arr_expand(&tmp_flows, (*flows)[flows_index[i]]);
427+
(*flows)[flows_index[i]] = NULL;
428+
}
429+
for (size_t i = 0; i < tal_count(*flows); i++) {
430+
(*flows)[i] = tal_free((*flows)[i]);
431+
}
432+
tal_resize(flows, 0);
433+
for (size_t i = 0; i < tal_count(tmp_flows); i++) {
434+
tal_arr_expand(flows, tmp_flows[i]);
435+
}
436+
437+
tal_free(working_ctx);
424438
return NULL;
425439
}

0 commit comments

Comments
 (0)