From a75de624773ccb5549b2493953959537c3c20ff0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 23 Aug 2018 08:57:23 +0930 Subject: [PATCH] chaintopology: always initialize smoothed feerate if it's the first entry. Not just during startup: we could have bitcoind not give estimates until later, but we don't want to smooth with zero. The test changes in next patch trigger this, so I didn't write a test with this patch. Signed-off-by: Rusty Russell --- lightningd/chaintopology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 2060d18cd..3b418cfbc 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -309,7 +309,7 @@ static void update_feerates(struct bitcoind *bitcoind, continue; /* Initial smoothed feerate is the polled feerate */ - if (topo->feerate_uninitialized) { + if (!topo->feerate[i]) { old_feerates[i] = feerate; log_debug(topo->log, "Smoothed feerate estimate for %s initialized to polled estimate %u",