lightningd: clarify uses of dynamic (mempool) feerate floor, and static.

We have the FEERATE_FLOOR constant if you don't care, but usually you want
to use the current bitcoind lower limit, so call get_feerate_floor()
(which is currently the same, but coming!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-04-07 14:09:53 +09:30
parent 7aa8c76002
commit faae44713b
8 changed files with 29 additions and 12 deletions

View File

@@ -415,8 +415,8 @@ static void update_feerates(struct bitcoind *bitcoind,
feerate, alpha);
}
if (feerate < feerate_floor()) {
feerate = feerate_floor();
if (feerate < get_feerate_floor(topo)) {
feerate = get_feerate_floor(topo);
log_debug(topo->log,
"... feerate estimate for %s hit floor %u",
feerate_name(i), feerate);
@@ -487,6 +487,12 @@ u32 penalty_feerate(struct chain_topology *topo)
return try_get_feerate(topo, FEERATE_PENALTY);
}
u32 get_feerate_floor(const struct chain_topology *topo)
{
/* FIXME: Make this dynamic! */
return FEERATE_FLOOR;
}
static struct command_result *json_feerates(struct command *cmd,
const char *buffer,
const jsmntok_t *obj UNNEEDED,
@@ -936,8 +942,8 @@ u32 feerate_min(struct lightningd *ld, bool *unknown)
}
}
if (min < feerate_floor())
return feerate_floor();
if (min < get_feerate_floor(ld->topology))
return get_feerate_floor(ld->topology);
return min;
}