mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 21:33:09 +00:00
move impl of hash to existing impl Transaction block
This commit is contained in:
parent
e1e018fcfc
commit
f01be72d8f
@ -57,16 +57,6 @@ pub struct Transaction {
|
||||
pub state_changes: (serde_json::Value, usize),
|
||||
}
|
||||
|
||||
impl Transaction {
|
||||
pub fn hash(&self) -> TreeHashType {
|
||||
let raw_data = serde_json::to_vec(&self).unwrap();
|
||||
let mut hasher = sha2::Sha256::new();
|
||||
hasher.update(&raw_data);
|
||||
TreeHashType::from(hasher.finalize_fixed())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct MintMoneyPublicTx {
|
||||
pub acc: [u8; 32],
|
||||
@ -161,6 +151,13 @@ impl ActionData {
|
||||
}
|
||||
|
||||
impl Transaction {
|
||||
pub fn hash(&self) -> TreeHashType {
|
||||
let raw_data = serde_json::to_vec(&self).unwrap();
|
||||
let mut hasher = sha2::Sha256::new();
|
||||
hasher.update(&raw_data);
|
||||
TreeHashType::from(hasher.finalize_fixed())
|
||||
}
|
||||
|
||||
pub fn log(&self) {
|
||||
info!("Transaction hash is {:?}", hex::encode(self.hash()));
|
||||
info!("Transaction tx_kind is {:?}", self.tx_kind);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user