- type Error = std::io::Error;
- fn try_into(self) -> std::io::Result<FeeResponse> {
- let errored = !self.0["errors"].is_null();
- Ok(FeeResponse {
- errored,
- feerate: match errored {
- true => None,
- // The feerate from bitcoind is in BTC/kb, and we want satoshis/kb.
- false => Some((self.0["feerate"].as_f64().unwrap() * 100_000_000.0).round() as u32)
- }
- })
- }
+ type Error = std::io::Error;
+ fn try_into(self) -> std::io::Result<FeeResponse> {
+ let errored = !self.0["errors"].is_null();
+ Ok(FeeResponse {
+ errored,
+ feerate: match self.0["feerate"].as_f64() {
+ Some(fee) => Some((fee * 100_000_000.0).round() as u32),
+ None => None,
+ },
+ })
+ }