Преглед изворни кода

include the hash of the genesis block in the hello message, to make sure different versions do not collide

Malte Kraus пре 8 година
родитељ
комит
334166e393
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      src/protocol.py

+ 3 - 1
src/protocol.py

@@ -10,13 +10,15 @@ from binascii import unhexlify, hexlify
 from uuid import UUID, uuid4
 from typing import Callable, List
 
+from .block import GENESIS_BLOCK_HASH
+
 
 __all__ = ['Protocol', 'PeerConnection', 'MAX_PEERS', 'HELLO_MSG']
 
 MAX_PEERS = 10
 """ The maximum number of peers that we connect to."""
 
-HELLO_MSG = b"bl0ckch41n"
+HELLO_MSG = b"bl0ckch41n" + hexlify(GENESIS_BLOCK_HASH)[:30]
 """ The hello message two peers use to make sure they are speaking the same protocol. """
 
 # TODO: set this centrally