X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fconvert.rs;h=a652980e3ddbd9a20e6cbf5e54092938a1ffb5ac;hb=cae92e8b151d8459fee7a7eb0b823c25951363f5;hp=00ff84dc1be1161cf64582fbd0bfb07ecb312721;hpb=d9e9c01d33f291cf4846c0406a3e00c9ecbd543d;p=ldk-sample diff --git a/src/convert.rs b/src/convert.rs index 00ff84d..a652980 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -61,10 +61,9 @@ impl TryInto for JsonResponse { 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), + feerate: match self.0["feerate"].as_f64() { + Some(fee) => Some((fee * 100_000_000.0).round() as u32), + None => None, }, }) } @@ -73,6 +72,7 @@ impl TryInto for JsonResponse { pub struct BlockchainInfo { pub latest_height: usize, pub latest_blockhash: BlockHash, + pub chain: String, } impl TryInto for JsonResponse { @@ -82,6 +82,7 @@ impl TryInto for JsonResponse { latest_height: self.0["blocks"].as_u64().unwrap() as usize, latest_blockhash: BlockHash::from_hex(self.0["bestblockhash"].as_str().unwrap()) .unwrap(), + chain: self.0["chain"].as_str().unwrap().to_string(), }) } }