Răsfoiți Sursa

[crypsinous] fix eta bytes pallas conversion

mohab metwally 4 ani în urmă
părinte
comite
6de880d9f9
1 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 6 2
      src/stakeholder/stakeholder.rs

+ 6 - 2
src/stakeholder/stakeholder.rs

@@ -17,7 +17,8 @@ pub struct Stakeholder
 
 impl Stakeholder
 {
-    pub fn new() -> Result<Self> {
+    pub fn new() -> Result<Self>
+    {
         //TODO initialize the blockchain
         let path = "/tmp";
         let db = sled::open(path).unwrap();
@@ -37,7 +38,10 @@ impl Stakeholder
     {
         let last_proof_slot : u64 = 0;
         let (sl, proof_tx_hash) = self.blockchain.last().unwrap();
-        let bytes = *proof_tx_hash.as_bytes();
+        let mut bytes : [u8;32] = *proof_tx_hash.as_bytes();
+        // read first 254 bits
+        bytes[30] = 0;
+        bytes[31] = 0;
         pallas::Base::from_repr(bytes).unwrap()
     }
 }