[bug] estimate_fee

This commit is contained in:
Sosthene 2024-05-18 16:33:25 +02:00
parent 4455c76663
commit 083843a94a
2 changed files with 9 additions and 6 deletions

View File

@ -166,12 +166,16 @@ impl Daemon {
Ok(Self { rpc })
}
pub(crate) fn estimate_fee(&self, nblocks: u16) -> Result<Option<Amount>> {
Ok(self
pub(crate) fn estimate_fee(&self, nblocks: u16) -> Result<Amount> {
let res = self
.rpc
.estimate_smart_fee(nblocks, None)
.context("failed to estimate fee")?
.fee_rate)
.context("failed to estimate fee")?;
if res.errors.is_some() {
Err(Error::msg(serde_json::to_string(&res.errors.unwrap())?))
} else {
Ok(res.fee_rate.unwrap())
}
}
pub(crate) fn get_relay_fee(&self) -> Result<Amount> {

View File

@ -207,8 +207,7 @@ fn faucet_send(
let fee_estimate = shared_daemon
.lock_anyhow()?
.estimate_fee(6)
.unwrap_or(Some(Amount::from_sat(1000)))
.unwrap()
.unwrap_or(Amount::from_sat(1000))
.checked_div(1000)
.unwrap();