From d2e2d60e1475e02eb472b72343206d0fbfea2689 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Wed, 8 May 2024 06:41:45 +0200 Subject: [PATCH] revert estimation fee change commit Signed-off-by: Vincenzo Palazzo --- folgore-esplora/src/lib.rs | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/folgore-esplora/src/lib.rs b/folgore-esplora/src/lib.rs index 3c8b2a0..2d43f29 100644 --- a/folgore-esplora/src/lib.rs +++ b/folgore-esplora/src/lib.rs @@ -441,25 +441,27 @@ mod tests { #[derive(Deserialize, Debug)] struct FeeEstimation { - feerates: serde_json::Value, + feerates: Vec, + } + + #[derive(Deserialize, Debug)] + struct PerBlockFee { + blocks: u64, + feerate: u64, } let fee_estimation: FeeEstimation = serde_json::from_value(fee_estimation).unwrap(); - assert!(fee_estimation.feerates.get("0").is_some()); - assert!(fee_estimation.feerates.get("2").is_some()); - assert!(fee_estimation.feerates.get("6").is_some()); - assert!(fee_estimation.feerates.get("12").is_some()); - assert!(fee_estimation.feerates.get("100").is_some()); - - assert_eq!( - fee_estimation.feerates.get("0").unwrap(), - 15 * 1000, - "{:?}", - fee_estimation - ); - assert_eq!(fee_estimation.feerates.get("2").unwrap(), 45 * 1000); - assert_eq!(fee_estimation.feerates.get("6").unwrap(), 26 * 1000); - assert_eq!(fee_estimation.feerates.get("12").unwrap(), 21 * 1000); - assert_eq!(fee_estimation.feerates.get("100").unwrap(), 15 * 1000); + assert!(!fee_estimation.feerates.is_empty(), "{:?}", fee_ranges); + assert_eq!(fee_estimation.feerates[0].blocks, 0); + assert_eq!(fee_estimation.feerates[1].blocks, 2); + assert_eq!(fee_estimation.feerates[2].blocks, 6); + assert_eq!(fee_estimation.feerates[3].blocks, 12); + assert_eq!(fee_estimation.feerates[4].blocks, 100); + + assert_eq!(fee_estimation.feerates[0].feerate, 15 * 1000); + assert_eq!(fee_estimation.feerates[1].feerate, 45 * 1000); + assert_eq!(fee_estimation.feerates[2].feerate, 26 * 1000); + assert_eq!(fee_estimation.feerates[3].feerate, 21 * 1000); + assert_eq!(fee_estimation.feerates[4].feerate, 15 * 1000); } }