From e286108bb5afcefc0d0cb42e0e367cabb8e0c5ee Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Thu, 10 Jul 2025 13:00:27 -0300 Subject: [PATCH] add TODO to remove unwrap --- common/src/transaction.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/transaction.rs b/common/src/transaction.rs index cb86661..3f2dcb2 100644 --- a/common/src/transaction.rs +++ b/common/src/transaction.rs @@ -153,6 +153,9 @@ impl ActionData { impl Transaction { /// Computes and returns the SHA-256 hash of the JSON-serialized representation of `self`. pub fn hash(&self) -> TreeHashType { + // TODO: Remove `unwrap` by implementing a `to_bytes` method + // that deterministically encodes all transaction fields to bytes + // and guarantees serialization will succeed. let raw_data = serde_json::to_vec(&self).unwrap(); let mut hasher = sha2::Sha256::new(); hasher.update(&raw_data);