From c667d5c8be02b57615feaec29bf45fe32f2ce464 Mon Sep 17 00:00:00 2001 From: "Dr. Maxim Orlovsky" <orlovsky@lnp-bp.org> Date: Thu, 5 Oct 2023 19:57:04 +0200 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoe FaltibĂ <7492268+zoedberg@users.noreply.github.com> --- primitives/src/tx.rs | 4 ++-- primitives/src/util.rs | 2 +- primitives/src/weights.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/primitives/src/tx.rs b/primitives/src/tx.rs index 1285082b..dc457ff4 100644 --- a/primitives/src/tx.rs +++ b/primitives/src/tx.rs @@ -144,7 +144,7 @@ impl Outpoint { } #[inline] - pub const fn coinbse() -> Self { + pub const fn coinbase() -> Self { Self { txid: Txid::coinbase(), vout: Vout::from_u32(0), @@ -802,7 +802,7 @@ mod test { "80b7d8a82d5d5bf92905b06f2014dd699e03837ca172e3a59d51426ebbe3e7f5".to_string() ); - /* TODO: Enable once weight calculation is threr + /* TODO: Enable once weight calculation is there const EXPECTED_WEIGHT: Weight = Weight::from_wu(442); assert_eq!(realtx.weight(), EXPECTED_WEIGHT); assert_eq!(realtx.total_size(), tx_bytes.len()); diff --git a/primitives/src/util.rs b/primitives/src/util.rs index a6707cbf..cef8139c 100644 --- a/primitives/src/util.rs +++ b/primitives/src/util.rs @@ -97,7 +97,7 @@ impl Chain { #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] pub struct VarInt(pub u64); -#[allow(clippy::len_without_is_empty)] // VarInt has on concept of 'is_empty'. +#[allow(clippy::len_without_is_empty)] // VarInt has no concept of 'is_empty'. impl VarInt { pub const fn new(u: u64) -> Self { VarInt(u) } diff --git a/primitives/src/weights.rs b/primitives/src/weights.rs index 423fbffb..e9436e78 100644 --- a/primitives/src/weights.rs +++ b/primitives/src/weights.rs @@ -115,7 +115,7 @@ impl Weight for TxIn { impl Weight for TxOut { fn weight_units(&self) -> WeightUnits { - WeightUnits::no_discount(8) //value + WeightUnits::no_discount(8) // value + self.script_pubkey.weight_units() } }