diff --git a/src/app.rs b/src/app.rs index 46c9799..c9ed834 100644 --- a/src/app.rs +++ b/src/app.rs @@ -320,7 +320,7 @@ fn load_wallet(rpc: &RpcClient, name: &str, create_if_missing: bool) -> Result<( if create_if_missing && e.code == RPC_WALLET_NOT_FOUND => { info!(target: "bwt::wallet", "wallet '{}' does not exists, creating it", name); - rpc.create_wallet(name, Some(true), Some(true), None, None)?; + rpc.create_wallet_(name)?; Ok(()) } Err(e) => Err(e.into()), diff --git a/src/util/bitcoincore_ext.rs b/src/util/bitcoincore_ext.rs index 3ed5a35..35fd055 100644 --- a/src/util/bitcoincore_ext.rs +++ b/src/util/bitcoincore_ext.rs @@ -88,6 +88,23 @@ pub trait RpcApiExt: RpcApi { ) } + // Pending https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/174 + fn create_wallet_(&self, wallet_name: &str) -> RpcResult { + // Create with disable_private_keys=true, blank=true, descriptors=false + self.call( + "createwallet", + &[ + json!(wallet_name), + true.into(), + true.into(), + json!(""), + false.into(), + false.into(), + json!(null), + ], + ) + } + fn prune_blockchain(&self, until: u64) -> RpcResult { self.call("pruneblockchain", &[json!(until)]) } diff --git a/src/util/mod.rs b/src/util/mod.rs index a7ef98b..c52ebdd 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -32,8 +32,11 @@ pub fn make_fee_histogram(mempool_entries: HashMap) -> Vec<(f32, u3 let vsize = entry["vsize"] .as_u64() .or_else(|| entry["size"].as_u64()) - .unwrap(); // bitcoind is borked if this fails - let fee = entry["fee"].as_f64().unwrap(); + .expect("invalid getrawmempool from bitcoind"); + let fee = entry["fees"]["base"] + .as_f64() + .or_else(|| entry["fee"].as_f64()) + .expect("invalid getrawmempool from bitcoind"); let feerate = fee as f32 / vsize as f32 * 100_000_000f32; (vsize as u32, feerate) })