Browse Source

encode timestamp float as 8 byte little endian in hash

Malte Kraus 8 năm trước cách đây
mục cha
commit
6699e44225
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      src/block.py

+ 2 - 1
src/block.py

@@ -111,9 +111,10 @@ class Block:
         hasher = get_hasher()
         hasher.update(self.prev_block_hash)
         hasher.update(self.merkle_root_hash)
-        hasher.update(str(self.time.timestamp()).encode())
+        hasher.update(pack("<d", self.time.timestamp()))
         hasher.update(self._int_to_bytes(self.difficulty))
         return hasher
+
     def finish_hash(self, hasher):
         """
         Finishes the hash in `hasher` with the nonce in this block. The proof of