From 58e6248e6a659d849176fc060565f34484ccdbd3 Mon Sep 17 00:00:00 2001 From: Stanimal Date: Sun, 17 Oct 2021 09:18:40 +0400 Subject: [PATCH] Minor code comment improvements --- base_layer/core/src/transactions/transaction.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/base_layer/core/src/transactions/transaction.rs b/base_layer/core/src/transactions/transaction.rs index 1ba27fe98f..dc968a917e 100644 --- a/base_layer/core/src/transactions/transaction.rs +++ b/base_layer/core/src/transactions/transaction.rs @@ -178,13 +178,10 @@ impl ConsensusDecoding for OutputFeatures { ), )); } + // Decode safety: read_varint will stop reading the varint after 10 bytes let maturity = reader.read_varint()?; let flags = OutputFlags::consensus_decode(reader)?; - Ok(Self { - flags, - // Decode safety: read_varint allows a maximum of a 10-byte varint - maturity, - }) + Ok(Self { flags, maturity }) } } @@ -246,10 +243,10 @@ impl ConsensusDecoding for OutputFlags { // SAFETY: we have 3 options here: // 1. error if unsupported flags are used, meaning that every new flag will be a hard fork // 2. truncate unsupported flags, means different hashes will be produced for the same block - // 3. ignore unsupported flags, which could be set at any time and persisted to the database. + // 3. ignore unsupported flags, which could be set at any time and persisted to the blockchain. // Once those flags are defined at some point in the future, depending on the functionality of the flag, // a consensus rule may be needed that ignores flags prior to a given block height. - // Option 3 is the best tradeoff + // Option 3 is used here Ok(unsafe { OutputFlags::from_bits_unchecked(u8::from_le_bytes(buf)) }) } }