[bug] estimate_fee
This commit is contained in:
parent
4455c76663
commit
083843a94a
@ -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> {
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user