From 651168658162e48ac950c85ecdedcf01f0f5788a Mon Sep 17 00:00:00 2001 From: smartgoo Date: Sun, 8 Dec 2024 07:58:09 -0500 Subject: [PATCH] mass calc params --- Cargo.lock | 8 ++++---- wallet/core/src/bindings/python/tx/mass.rs | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c97fb409..7cc04933f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3039,7 +3039,7 @@ dependencies = [ [[package]] name = "kaspa-python-core" -version = "0.15.3" +version = "0.15.4" dependencies = [ "cfg-if 1.0.0", "faster-hex", @@ -3048,7 +3048,7 @@ dependencies = [ [[package]] name = "kaspa-python-macros" -version = "0.15.3" +version = "0.15.4" dependencies = [ "convert_case 0.6.0", "proc-macro-error", @@ -3619,7 +3619,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-python" -version = "0.15.3" +version = "0.15.4" dependencies = [ "ahash", "cfg-if 1.0.0", @@ -4882,7 +4882,7 @@ dependencies = [ [[package]] name = "python" -version = "0.15.3" +version = "0.15.4" dependencies = [ "cfg-if 1.0.0", "kaspa-addresses", diff --git a/wallet/core/src/bindings/python/tx/mass.rs b/wallet/core/src/bindings/python/tx/mass.rs index a8ad4720d..c18b3d8f6 100644 --- a/wallet/core/src/bindings/python/tx/mass.rs +++ b/wallet/core/src/bindings/python/tx/mass.rs @@ -14,8 +14,7 @@ pub fn maximum_standard_transaction_mass() -> u64 { pub fn calculate_unsigned_transaction_mass(network_id: &str, tx: &Transaction, minimum_signatures: Option) -> PyResult { let network_id = NetworkId::from_str(network_id)?; let consensus_params = Params::from(network_id); - let network_params = NetworkParams::from(network_id); - let mc = mass::MassCalculator::new(&consensus_params, &network_params); + let mc = mass::MassCalculator::new(&consensus_params); Ok(mc.calc_overall_mass_for_unsigned_client_transaction(tx, minimum_signatures.unwrap_or(1))?) } @@ -25,8 +24,7 @@ pub fn calculate_unsigned_transaction_mass(network_id: &str, tx: &Transaction, m pub fn update_unsigned_transaction_mass(network_id: &str, tx: &Transaction, minimum_signatures: Option) -> PyResult { let network_id = NetworkId::from_str(network_id)?; let consensus_params = Params::from(network_id); - let network_params = NetworkParams::from(network_id); - let mc = mass::MassCalculator::new(&consensus_params, network_params); + let mc = mass::MassCalculator::new(&consensus_params); let mass = mc.calc_overall_mass_for_unsigned_client_transaction(tx, minimum_signatures.unwrap_or(1))?; if mass > MAXIMUM_STANDARD_TRANSACTION_MASS { Ok(false) @@ -46,8 +44,7 @@ pub fn calculate_unsigned_transaction_fee( ) -> PyResult> { let network_id = NetworkId::from_str(network_id)?; let consensus_params = Params::from(network_id); - let network_params = NetworkParams::from(network_id); - let mc = mass::MassCalculator::new(&consensus_params, network_params); + let mc = mass::MassCalculator::new(&consensus_params); let mass = mc.calc_overall_mass_for_unsigned_client_transaction(tx, minimum_signatures.unwrap_or(1))?; if mass > MAXIMUM_STANDARD_TRANSACTION_MASS { Ok(None)