@ -31,8 +31,6 @@ import time
from test_framework . siphash import siphash256
from test_framework . util import hex_str_to_bytes , assert_equal
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
MAX_LOCATOR_SZ = 101
MAX_BLOCK_BASE_SIZE = 1000000
MAX_BLOOM_FILTER_SIZE = 36000
@ -1018,7 +1016,7 @@ class CMerkleBlock:
# Objects that correspond to messages on the wire
class msg_version :
__slots__ = ( " addrFrom " , " addrTo " , " nNonce " , " nR elay" , " nServices " ,
__slots__ = ( " addrFrom " , " addrTo " , " nNonce " , " r elay" , " nServices " ,
" nStartingHeight " , " nTime " , " nVersion " , " strSubVer " )
msgtype = b " version "
@ -1031,7 +1029,7 @@ class msg_version:
self . nNonce = random . getrandbits ( 64 )
self . strSubVer = ' '
self . nStartingHeight = - 1
self . nRelay = MY_RELAY
self . relay = 0
def deserialize ( self , f ) :
self . nVersion = struct . unpack ( " <i " , f . read ( 4 ) ) [ 0 ]
@ -1050,11 +1048,11 @@ class msg_version:
if self . nVersion > = 70001 :
# Relay field is optional for version 70001 onwards
try :
self . nR elay = struct . unpack ( " <b " , f . read ( 1 ) ) [ 0 ]
self . r elay = struct . unpack ( " <b " , f . read ( 1 ) ) [ 0 ]
except :
self . nR elay = 0
self . r elay = 0
else :
self . nR elay = 0
self . r elay = 0
def serialize ( self ) :
r = b " "
@ -1066,14 +1064,14 @@ class msg_version:
r + = struct . pack ( " <Q " , self . nNonce )
r + = ser_string ( self . strSubVer . encode ( ' utf-8 ' ) )
r + = struct . pack ( " <i " , self . nStartingHeight )
r + = struct . pack ( " <b " , self . nR elay)
r + = struct . pack ( " <b " , self . r elay)
return r
def __repr__ ( self ) :
return ' msg_version(nVersion= %i nServices= %i nTime= %s addrTo= %s addrFrom= %s nNonce=0x %016X strSubVer= %s nStartingHeight= %i nR elay=%i ) ' \
return ' msg_version(nVersion= %i nServices= %i nTime= %s addrTo= %s addrFrom= %s nNonce=0x %016X strSubVer= %s nStartingHeight= %i r elay=%i ) ' \
% ( self . nVersion , self . nServices , time . ctime ( self . nTime ) ,
repr ( self . addrTo ) , repr ( self . addrFrom ) , self . nNonce ,
self . strSubVer , self . nStartingHeight , self . nR elay)
self . strSubVer , self . nStartingHeight , self . r elay)
class msg_verack :