mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Don't fail if bitcoind fee estimation is disabled (#1060)
This commit is contained in:
parent
785eca68ff
commit
1b0bb23fab
@ -148,11 +148,15 @@ impl Daemon {
|
||||
}
|
||||
|
||||
pub(crate) fn estimate_fee(&self, nblocks: u16) -> Result<Option<Amount>> {
|
||||
Ok(self
|
||||
.rpc
|
||||
.estimate_smart_fee(nblocks, None)
|
||||
.context("failed to estimate fee")?
|
||||
.fee_rate)
|
||||
let res = self.rpc.estimate_smart_fee(nblocks, None);
|
||||
if let Err(bitcoincore_rpc::Error::JsonRpc(jsonrpc::Error::Rpc(RpcError {
|
||||
code: -32603,
|
||||
..
|
||||
}))) = res
|
||||
{
|
||||
return Ok(None); // don't fail when fee estimation is disabled (e.g. with `-blocksonly=1`)
|
||||
}
|
||||
Ok(res.context("failed to estimate fee")?.fee_rate)
|
||||
}
|
||||
|
||||
pub(crate) fn get_relay_fee(&self) -> Result<Amount> {
|
||||
|
Loading…
Reference in New Issue
Block a user