Fixed serializiation determinacy problems.

This commit is contained in:
Dave Hrycyszyn
2024-06-18 11:19:36 +01:00
parent 416d1ad88b
commit a4441af53a
9 changed files with 44 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
use std::path::PathBuf;
use bft_json_crdt::json_crdt::SignedOp;
use serde_json::{json, Value};
pub(crate) const KEY_FILE: &str = "keys.pem";
@@ -31,3 +32,13 @@ pub fn fake_transaction_json(from: String) -> Value {
"amount": 1
})
}
pub fn shappy(op: SignedOp) -> String {
let b = serde_json::to_string(&op).unwrap().into_bytes();
sha256::digest(b).to_string()
}
pub fn shassy(text: String) -> String {
let b = text.into_bytes();
sha256::digest(b).to_string()
}