diff options
author | Yigit Sever | 2022-04-23 21:31:57 +0300 |
---|---|---|
committer | Yigit Sever | 2022-04-23 21:32:51 +0300 |
commit | 949da3fd6d2143d23fe1b84cf83f80418fd05840 (patch) | |
tree | 280ba40a2b4b9dbf8c233ecab8649af2c6acd47e /src | |
parent | 9b6c529de0136fc6648c02031e0e4b7c4dd14387 (diff) | |
download | gradecoin-949da3fd6d2143d23fe1b84cf83f80418fd05840.tar.gz gradecoin-949da3fd6d2143d23fe1b84cf83f80418fd05840.tar.bz2 gradecoin-949da3fd6d2143d23fe1b84cf83f80418fd05840.zip |
Add timestamp to transaction fingerprint hash
This should include some randomness and prevent someone just simulating
the whole chain on their own
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index 6e30ae3..997867c 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
@@ -914,7 +914,7 @@ fn authorize_proposer(jwt_token: &str, user_pem: &str) -> Result<TokenData<Claim | |||
914 | } | 914 | } |
915 | 915 | ||
916 | fn calculate_transaction_id(source: &str, target: &str) -> String { | 916 | fn calculate_transaction_id(source: &str, target: &str) -> String { |
917 | let long_fingerprint = format!("{}{}", source, target); | 917 | let long_fingerprint = format!("{}{}{}", source, target, Utc::now()); |
918 | let id = format!("{:x}", Sha256::digest(long_fingerprint.as_bytes())); | 918 | let id = format!("{:x}", Sha256::digest(long_fingerprint.as_bytes())); |
919 | id | 919 | id |
920 | } | 920 | } |