From 220488c91b743fda953928bc0cdc56301d139dd2 Mon Sep 17 00:00:00 2001 From: Neotamandua <107320179+Neotamandua@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:46:12 +0200 Subject: [PATCH] node-data: rename hash to digest - Update comments --- node-data/src/ledger/faults.rs | 4 ++-- node-data/src/ledger/transaction.rs | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/node-data/src/ledger/faults.rs b/node-data/src/ledger/faults.rs index f9948d39f..ca9b42bf0 100644 --- a/node-data/src/ledger/faults.rs +++ b/node-data/src/ledger/faults.rs @@ -81,8 +81,8 @@ impl From for InvalidFault { } impl Fault { - /// Hash the serialized form - pub fn hash(&self) -> [u8; 32] { + /// Digest the serialized form + pub fn digest(&self) -> [u8; 32] { let mut b = vec![]; self.write(&mut b).expect("Write to a vec shall not fail"); sha3::Sha3_256::digest(&b[..]).into() diff --git a/node-data/src/ledger/transaction.rs b/node-data/src/ledger/transaction.rs index e4d13aa49..c7b4901a7 100644 --- a/node-data/src/ledger/transaction.rs +++ b/node-data/src/ledger/transaction.rs @@ -55,14 +55,16 @@ pub struct SpentTransaction { } impl Transaction { - /// Computes the hash of the transaction. + /// Computes the hash digest of the entire transaction data. /// - /// This method returns the hash of the entire + /// This method returns the Sha3 256 digest of the entire /// transaction in its serialized form /// + /// The digest hash is currently only being used in the merkle tree. + /// /// ### Returns /// An array of 32 bytes representing the hash of the transaction. - pub fn hash(&self) -> [u8; 32] { + pub fn digest(&self) -> [u8; 32] { sha3::Sha3_256::digest(self.inner.to_var_bytes()).into() }