From 1abc5f8b0040cb83b431e50811029f2c200ca0da Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 24 Jun 2021 19:57:06 +0800 Subject: [PATCH] chainfee: change min conf target to be 1 This commit changes the minBlockTarget used by the WebAPIEstimator to be 1, inline with the bitcoind's accepted min conf target. --- lntest/fee_service_test.go | 2 +- lnwallet/chainfee/estimator.go | 2 +- lnwallet/chainfee/estimator_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lntest/fee_service_test.go b/lntest/fee_service_test.go index c7ad38c4..c8c0ca89 100644 --- a/lntest/fee_service_test.go +++ b/lntest/fee_service_test.go @@ -34,6 +34,6 @@ func TestFeeService(t *testing.T) { require.NoError(t, err) require.Equal( - t, "{\"fee_by_block_target\":{\"2\":20000}}", string(body), + t, "{\"fee_by_block_target\":{\"1\":20000}}", string(body), ) } diff --git a/lnwallet/chainfee/estimator.go b/lnwallet/chainfee/estimator.go index 59d2b2f2..eee26148 100644 --- a/lnwallet/chainfee/estimator.go +++ b/lnwallet/chainfee/estimator.go @@ -24,7 +24,7 @@ const ( // minBlockTarget is the lowest number of blocks confirmations that // a WebAPIEstimator will cache fees for. Requesting an estimate for // less than this will result in an error. - minBlockTarget uint32 = 2 + minBlockTarget uint32 = 1 // minFeeUpdateTimeout represents the minimum interval in which a // WebAPIEstimator will request fresh fees from its API. diff --git a/lnwallet/chainfee/estimator_test.go b/lnwallet/chainfee/estimator_test.go index f98ae80c..2900ff17 100644 --- a/lnwallet/chainfee/estimator_test.go +++ b/lnwallet/chainfee/estimator_test.go @@ -172,7 +172,7 @@ func TestWebAPIFeeEstimator(t *testing.T) { est uint32 err string }{ - {"target_below_min", 1, 12345, 12345, "too low, minimum"}, + {"target_below_min", 0, 12345, 12345, "too low, minimum"}, {"target_w_too-low_fee", 10, 42, feeFloor, ""}, {"API-omitted_target", 2, 0, 0, "web API does not include"}, {"valid_target", 20, 54321, 54321, ""},