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

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

Malte Kraus 8 лет назад
Родитель
Сommit
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 uuid import UUID, uuid4
 from typing import Callable, List
 from typing import Callable, List
 
 
+from .block import GENESIS_BLOCK_HASH
+
 
 
 __all__ = ['Protocol', 'PeerConnection', 'MAX_PEERS', 'HELLO_MSG']
 __all__ = ['Protocol', 'PeerConnection', 'MAX_PEERS', 'HELLO_MSG']
 
 
 MAX_PEERS = 10
 MAX_PEERS = 10
 """ The maximum number of peers that we connect to."""
 """ 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. """
 """ The hello message two peers use to make sure they are speaking the same protocol. """
 
 
 # TODO: set this centrally
 # TODO: set this centrally