Skip to content

Commit 9c9b806

Browse files
committed
f esplora-client: Account for convert_fee_rate being fallible
1 parent 033e9c1 commit 9c9b806

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/chain/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -787,18 +787,12 @@ impl ChainSource {
787787
for target in confirmation_targets {
788788
let num_blocks = get_num_block_defaults_for_target(target);
789789

790+
// Convert the retrieved fee rate and fall back to 1 sat/vb if we fail or it
791+
// yields less than that. This is mostly necessary to continue on
792+
// `signet`/`regtest` where we might not get estimates (or bogus values).
790793
let converted_estimate_sat_vb =
791-
esplora_client::convert_fee_rate(num_blocks, estimates.clone()).map_err(
792-
|e| {
793-
log_error!(
794-
logger,
795-
"Failed to convert fee rate estimates for {:?}: {}",
796-
target,
797-
e
798-
);
799-
Error::FeerateEstimationUpdateFailed
800-
},
801-
)?;
794+
esplora_client::convert_fee_rate(num_blocks, estimates.clone())
795+
.map_or(1.0, |converted| converted.max(1.0));
802796

803797
let fee_rate =
804798
FeeRate::from_sat_per_kwu((converted_estimate_sat_vb * 250.0) as u64);

0 commit comments

Comments
 (0)