Skip to content

Commit a8a6a44

Browse files
committed
askrene: clean up renamed functions.
We added _noidx versions of the sort functions, but now they're the only ones, we can rename them to the old names. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 7c7a4f8 commit a8a6a44

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

plugins/askrene/refine.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ enum why_capped {
168168
};
169169

170170
/* Reverse order: bigger first */
171-
static int revcmp_flows_noidx(struct flow *const *a, struct flow *const *b, void *unused)
171+
static int revcmp_flows(struct flow *const *a, struct flow *const *b, void *unused)
172172
{
173173
if (amount_msat_eq((*a)->delivers, (*b)->delivers))
174174
return 0;
@@ -309,7 +309,7 @@ remove_htlc_min_violations(const tal_t *ctx, struct route_query *rq,
309309
}
310310

311311

312-
static struct amount_msat sum_all_deliver_noidx(struct flow **flows)
312+
static struct amount_msat sum_all_deliver(struct flow **flows)
313313
{
314314
struct amount_msat all_deliver = AMOUNT_MSAT(0);
315315
for (size_t i = 0; i < tal_count(flows); i++) {
@@ -330,14 +330,14 @@ static struct amount_msat remove_excess(struct flow ***flows,
330330
return AMOUNT_MSAT(0);
331331

332332
struct amount_msat all_deliver, excess;
333-
all_deliver = sum_all_deliver_noidx(*flows);
333+
all_deliver = sum_all_deliver(*flows);
334334

335335
/* early exit: there is no excess */
336336
if (!amount_msat_sub(&excess, all_deliver, max_deliver) ||
337337
amount_msat_is_zero(excess))
338338
return all_deliver;
339339

340-
asort(*flows, tal_count(*flows), revcmp_flows_noidx, NULL);
340+
asort(*flows, tal_count(*flows), revcmp_flows, NULL);
341341

342342
/* Remove the smaller parts if they deliver less than the
343343
* excess. */
@@ -396,14 +396,14 @@ static struct amount_msat increase_flows(const struct route_query *rq,
396396
return AMOUNT_MSAT(0);
397397

398398
struct amount_msat all_deliver, defect;
399-
all_deliver = sum_all_deliver_noidx(flows);
399+
all_deliver = sum_all_deliver(flows);
400400

401401
/* early exit: target is already met */
402402
if (!amount_msat_sub(&defect, deliver, all_deliver) ||
403403
amount_msat_is_zero(defect))
404404
return all_deliver;
405405

406-
asort(flows, tal_count(flows), revcmp_flows_noidx, NULL);
406+
asort(flows, tal_count(flows), revcmp_flows, NULL);
407407

408408
all_deliver = AMOUNT_MSAT(0);
409409
for (size_t i = 0;
@@ -484,7 +484,7 @@ const char *refine_flows(const tal_t *ctx, struct route_query *rq,
484484
}
485485

486486
/* remove 0 amount flows if any */
487-
asort(*flows, tal_count(*flows), revcmp_flows_noidx, NULL);
487+
asort(*flows, tal_count(*flows), revcmp_flows, NULL);
488488
for (int i = tal_count(*flows) - 1; i >= 0; i--) {
489489
if (!amount_msat_is_zero((*flows)[i]->delivers))
490490
break;

0 commit comments

Comments
 (0)