Просмотр исходного кода

bin/ircd2: remove [skip_serialize] caused read_confirms to reset to zero

Dastan-glitch 3 лет назад
Родитель
Сommit
aae1ec434b
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      bin/ircd2/src/model.rs

+ 3 - 2
bin/ircd2/src/model.rs

@@ -38,14 +38,15 @@ pub struct Event {
     pub previous_event_hash: EventId,
     pub previous_event_hash: EventId,
     pub action: EventAction,
     pub action: EventAction,
     pub timestamp: u64,
     pub timestamp: u64,
-    #[skip_serialize]
     pub read_confirms: u8,
     pub read_confirms: u8,
 }
 }
 
 
 impl Event {
 impl Event {
     pub fn hash(&self) -> EventId {
     pub fn hash(&self) -> EventId {
         let mut bytes = Vec::new();
         let mut bytes = Vec::new();
-        self.encode(&mut bytes).expect("serialize failed!");
+        let mut event_to_be_hashed = self.clone();
+        event_to_be_hashed.read_confirms = 0;
+        event_to_be_hashed.encode(&mut bytes).expect("serialize failed!");
 
 
         let mut hasher = Ripemd256::new();
         let mut hasher = Ripemd256::new();
         hasher.update(bytes);
         hasher.update(bytes);