Эх сурвалжийг харах

[crypsinous] fix eta bytes pallas conversion

mohab metwally 4 жил өмнө
parent
commit
6de880d9f9

+ 6 - 2
src/stakeholder/stakeholder.rs

@@ -17,7 +17,8 @@ pub struct Stakeholder
 
 
 impl Stakeholder
 impl Stakeholder
 {
 {
-    pub fn new() -> Result<Self> {
+    pub fn new() -> Result<Self>
+    {
         //TODO initialize the blockchain
         //TODO initialize the blockchain
         let path = "/tmp";
         let path = "/tmp";
         let db = sled::open(path).unwrap();
         let db = sled::open(path).unwrap();
@@ -37,7 +38,10 @@ impl Stakeholder
     {
     {
         let last_proof_slot : u64 = 0;
         let last_proof_slot : u64 = 0;
         let (sl, proof_tx_hash) = self.blockchain.last().unwrap();
         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()
         pallas::Base::from_repr(bytes).unwrap()
     }
     }
 }
 }