diff --git a/src/lib/DataProviderManager.ts b/src/lib/DataProviderManager.ts index 802f2e6..a66ca83 100644 --- a/src/lib/DataProviderManager.ts +++ b/src/lib/DataProviderManager.ts @@ -196,12 +196,10 @@ export class DataProviderManager { log.debug({ msg: `Estimates for dataPoint ${providerName}`, estimates }); keys.forEach((key) => { - // Only add the estimate if it has a higher confirmation target and a lower fee + // Only add the estimate if it has a higher confirmation target and a lower fee. if ( - (!mergedEstimates[key] && estimates[key]) || - (mergedEstimates[key] && - key > Math.max(...Object.keys(mergedEstimates).map(Number)) && - estimates[key] < Math.min(...Object.values(mergedEstimates))) + key > Math.max(...Object.keys(mergedEstimates).map(Number)) && + estimates[key] < Math.min(...Object.values(mergedEstimates)) ) { log.debug({ msg: `Adding estimate from ${providerName} with target ${key} and fee ${estimates[key]} to mergedEstimates`, diff --git a/test/DataProviderManager-merge.test.ts b/test/DataProviderManager-merge.test.ts index 696ef10..1454be0 100644 --- a/test/DataProviderManager-merge.test.ts +++ b/test/DataProviderManager-merge.test.ts @@ -69,6 +69,8 @@ class MockProvider3 implements Provider { "2": 15, "3": 5, "5": 3, + "6": 3, + "7": 3, }); getAllData = () => Promise.resolve({ @@ -79,6 +81,8 @@ class MockProvider3 implements Provider { "2": 15, "3": 5, "5": 3, + "6": 3, + "7": 3, }, }); }