Skip to content

Commit 84998f0

Browse files
committed
refactor(agnostic signing algo and proptest): generic
1 parent abb6803 commit 84998f0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

rust/immutable-ledger/src/serialize.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,18 @@ impl Block {
181181
if let Some(previous_block) = previous_block {
182182
// Standard block
183183
let hashed_previous_block = match self.block_header.previous_block_hash.0 {
184-
HashFunction::Blake3 => (
185-
HashFunction::Blake3,
186-
blake3(&previous_block.to_bytes()?)?.to_vec(),
187-
),
188-
HashFunction::Blake2b => (
189-
HashFunction::Blake2b,
190-
blake2b_512(&previous_block.to_bytes()?)?.to_vec(),
191-
),
184+
HashFunction::Blake3 => {
185+
(
186+
HashFunction::Blake3,
187+
blake3(&previous_block.to_bytes()?)?.to_vec(),
188+
)
189+
},
190+
HashFunction::Blake2b => {
191+
(
192+
HashFunction::Blake2b,
193+
blake2b_512(&previous_block.to_bytes()?)?.to_vec(),
194+
)
195+
},
192196
};
193197

194198
// chain_id MUST be the same as for the previous block (except for genesis).

0 commit comments

Comments
 (0)