From ff4d61122aa70ef8010c8aa6808ba7efc01a61d5 Mon Sep 17 00:00:00 2001 From: Matthew Howard Date: Thu, 1 Aug 2024 14:40:34 +0100 Subject: [PATCH] pybindings clippy changes --- wheel/src/api.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/wheel/src/api.rs b/wheel/src/api.rs index 69eccdf05..8c9c4f46f 100644 --- a/wheel/src/api.rs +++ b/wheel/src/api.rs @@ -70,8 +70,8 @@ use clvmr::serde::{node_from_bytes, node_from_bytes_backrefs}; use clvmr::ChiaDialect; use chia_bls::{ - hash_to_g2 as native_hash_to_g2, BlsCache, DerivableKey, GTElement, PublicKey, SecretKey, - Signature, + hash_to_g2 as native_hash_to_g2, BlsCache, DerivableKey, GTElement, PairingInfo, PublicKey, + SecretKey, Signature, }; #[pyfunction] @@ -369,16 +369,12 @@ pub fn py_validate_clvm_and_signature( constants: &ConsensusConstants, peak_height: u32, cache: Option, -) -> PyResult<(OwnedSpendBundleConditions, Vec<([u8; 32], Vec)>, f32)> { - let real_cache = if let Some(unwrapped_cache) = cache { - unwrapped_cache - } else { - BlsCache::default() - }; +) -> PyResult<(OwnedSpendBundleConditions, Vec, f32)> { + let real_cache = cache.unwrap_or_default(); let (owned_conditions, additions, duration) = validate_clvm_and_signature( new_spend, max_cost, - &constants, + constants, peak_height, &Arc::new(Mutex::new(real_cache)), // TODO: use cache properly ) @@ -408,12 +404,9 @@ pub fn py_get_conditions_from_spendbundle( #[pyfunction] #[pyo3(name = "get_flags_for_height_and_constants")] -pub fn py_get_flags_for_height_and_constants( - height: u32, - constants: &ConsensusConstants, -) -> PyResult { +pub fn py_get_flags_for_height_and_constants(height: u32, constants: &ConsensusConstants) -> u32 { let flags = get_flags_for_height_and_constants(height, constants); - Ok(flags) + flags } #[pymodule]