mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-07 07:43:11 +00:00
add TODO to remove unwrap
This commit is contained in:
parent
81b6d34693
commit
e286108bb5
@ -153,6 +153,9 @@ impl ActionData {
|
|||||||
impl Transaction {
|
impl Transaction {
|
||||||
/// Computes and returns the SHA-256 hash of the JSON-serialized representation of `self`.
|
/// Computes and returns the SHA-256 hash of the JSON-serialized representation of `self`.
|
||||||
pub fn hash(&self) -> TreeHashType {
|
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 raw_data = serde_json::to_vec(&self).unwrap();
|
||||||
let mut hasher = sha2::Sha256::new();
|
let mut hasher = sha2::Sha256::new();
|
||||||
hasher.update(&raw_data);
|
hasher.update(&raw_data);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user