Ensure all estimates below feeMinimum are excluded #54
+148
−64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses an issue in which invalid estimates (estimates below the configured fee minimum) were treated as valid if they came from the determined most relevant data providers (provider with the highest block height). In reality, even the provider with the highest block height can include invalid estimates that need to be filtered out.
This pull request introduces changes to the
DataProviderManager
class in thesrc/lib/DataProviderManager.ts
file and its associated tests. The changes mainly involve the refactoring of how fee estimates are handled, with the introduction of a new method to filter fee estimates, and changes to the merging of fee estimates. The tests have also been updated to reflect these changes.Refactoring of fee estimates handling:
src/lib/DataProviderManager.ts
: The comment in the fee calculation section was updated to reflect the new fee formatting approach. The conditional logic for applying the fee multiplier was removed, and the warning log for estimates below the minimum fee was also removed. A new private methodfilterEstimates
was introduced to handle the filtering of fee estimates based on the fee minimum. This method also logs a warning for estimates below the minimum fee. [1] [2]Changes to merging of fee estimates:
src/lib/DataProviderManager.ts
: ThemergeFeeEstimates
method was modified to initializemergedEstimates
as an empty object and to use the newfilterEstimates
method when iterating over data points. The condition for adding an estimate tomergedEstimates
was also updated to account for cases where an estimate for a block target does not yet exist inmergedEstimates
. [1] [2]Updates to tests:
test/DataProviderManager-merge.test.ts
: A new test file was added to specifically test the merging of fee estimates from multiple providers. Mock providers were created and registered to aDataProviderManager
instance, and a test was added to check that the fee estimates are merged correctly.test/DataProviderManager-sort.test.ts
: This file was renamed fromtest/DataProviderManager.test.ts
. The mock providers in this file were updated to return empty fee estimates, and the test for merging fee estimates was removed.