rust-esplora-client icon indicating copy to clipboard operation
rust-esplora-client copied to clipboard

Don't return 1.0 feerate if none is found by `convert_fee_rate`

Open ValuedMammal opened this issue 8 months ago • 2 comments

Change convert_fee_rate to return Option<f32> instead of Result.

PR #65 made this function effectively infallible by removing the parse int error while falling back to a bogus 1.0 feerate if a value isn't found in fee estimates. We could make it return an error if for example the given fee estimates map is empty without changing the function signature but in that case we would need a new Error variant making it a breaking change anyway, therefore just change the function to return Option which should only be None if given a target of 0 or an empty map assuming esplora always has a fee estimate for a target of 1 confirmation.

fixes #80

ValuedMammal avatar Jun 22 '24 21:06 ValuedMammal