chainfee: make sure web API has been started before estimating
Previously we may get a floor feerate when calling `EstimateFeePerKW` due to the fee estimator not finishing its startup process, which gives us an empty fee map. This is now fixed to return an error if the estimator is not started.
This commit is contained in:
2 files changed
+44
-26
No files matched your search
@@ -252,12 +252,12 @@ func TestWebAPIFeeEstimator(t *testing.T) {
|
||||
feeSource, false, minFeeUpdateTimeout, maxFeeUpdateTimeout,
|
||||
)
|
||||
|
||||
// Test that requesting a fee when no fees have been cached won't fail.
|
||||
// Test that when the estimator is not started, an error is returned.
|
||||
feeRate, err := estimator.EstimateFeePerKW(5)
|
||||
require.NoErrorf(t, err, "expected no error")
|
||||
require.Equalf(t, FeePerKwFloor, feeRate, "expected fee rate floor "+
|
||||
"returned when no cached fee rate found")
|
||||
require.Error(t, err, "expected an error")
|
||||
require.Zero(t, feeRate, "expected zero fee rate")
|
||||
|
||||
// Start the estimator.
|
||||
require.NoError(t, estimator.Start(), "unable to start fee estimator")
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in new issue
Block a user