[bug] estimate_fee
This commit is contained in:
parent
4455c76663
commit
083843a94a
@ -166,12 +166,16 @@ impl Daemon {
|
|||||||
Ok(Self { rpc })
|
Ok(Self { rpc })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn estimate_fee(&self, nblocks: u16) -> Result<Option<Amount>> {
|
pub(crate) fn estimate_fee(&self, nblocks: u16) -> Result<Amount> {
|
||||||
Ok(self
|
let res = self
|
||||||
.rpc
|
.rpc
|
||||||
.estimate_smart_fee(nblocks, None)
|
.estimate_smart_fee(nblocks, None)
|
||||||
.context("failed to estimate fee")?
|
.context("failed to estimate fee")?;
|
||||||
.fee_rate)
|
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> {
|
pub(crate) fn get_relay_fee(&self) -> Result<Amount> {
|
||||||
|
@ -207,8 +207,7 @@ fn faucet_send(
|
|||||||
let fee_estimate = shared_daemon
|
let fee_estimate = shared_daemon
|
||||||
.lock_anyhow()?
|
.lock_anyhow()?
|
||||||
.estimate_fee(6)
|
.estimate_fee(6)
|
||||||
.unwrap_or(Some(Amount::from_sat(1000)))
|
.unwrap_or(Amount::from_sat(1000))
|
||||||
.unwrap()
|
|
||||||
.checked_div(1000)
|
.checked_div(1000)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user