Skip to content

Commit

Permalink
revert estimation fee change commit
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed May 8, 2024
1 parent 34e2bf2 commit dc8ca62
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions folgore-esplora/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,25 +441,27 @@ mod tests {

#[derive(Deserialize, Debug)]
struct FeeEstimation {
feerates: serde_json::Value,
feerates: Vec<PerBlockFee>,
}

#[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);
}
}

0 comments on commit dc8ca62

Please sign in to comment.