bcli: don't feed CLN massive feerates.

Stay classy, signet!

Reported-by: Anthony Towns
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-07-10 15:23:19 +09:30 committed by Christian Decker
parent 0d1c46a5e5
commit b197b713be

View file

@ -683,6 +683,14 @@ static void json_add_feerate(struct json_stream *result, const char *fieldname,
const struct estimatefees_stash *stash,
uint64_t value)
{
/* Anthony Towns reported signet had a 900kbtc fee block, and then
* CLN got upset scanning feerate. It expects a u32. */
if (value > 0xFFFFFFFF) {
plugin_log(cmd->plugin, LOG_UNUSUAL,
"Feerate %"PRIu64" is ridiculous: trimming to 32 bites",
value);
value = 0xFFFFFFFF;
}
/* 0 is special, it means "unknown" */
if (value && value < stash->perkb_floor) {
plugin_log(cmd->plugin, LOG_DBG,