31
31
class msg_unrecognized :
32
32
"""Nonsensical message. Modeled after similar types in test_framework.messages."""
33
33
34
- command = b'badmsg'
34
+ msgtype = b'badmsg'
35
35
36
36
def __init__ (self , * , str_data ):
37
37
self .str_data = str_data .encode () if not isinstance (str_data , bytes ) else str_data
@@ -40,7 +40,7 @@ def serialize(self):
40
40
return ser_string (self .str_data )
41
41
42
42
def __repr__ (self ):
43
- return "{}(data={})" .format (self .command , self .str_data )
43
+ return "{}(data={})" .format (self .msgtype , self .str_data )
44
44
45
45
46
46
class InvalidMessagesTest (BitcoinTestFramework ):
@@ -63,7 +63,7 @@ def run_test(self):
63
63
self .test_magic_bytes ()
64
64
self .test_checksum ()
65
65
self .test_size ()
66
- self .test_command ()
66
+ self .test_msgtype ()
67
67
self .test_large_inv ()
68
68
69
69
node = self .nodes [0 ]
@@ -206,20 +206,20 @@ def test_size(self):
206
206
msg = conn .build_message (msg_unrecognized (str_data = "d" ))
207
207
cut_len = (
208
208
4 + # magic
209
- 12 # command
209
+ 12 # msgtype
210
210
)
211
211
# modify len to MAX_SIZE + 1
212
212
msg = msg [:cut_len ] + struct .pack ("<I" , 0x02000000 + 1 ) + msg [cut_len + 4 :]
213
213
self .nodes [0 ].p2p .send_raw_message (msg )
214
214
conn .wait_for_disconnect (timeout = 5 )
215
215
self .nodes [0 ].disconnect_p2ps ()
216
216
217
- def test_command (self ):
217
+ def test_msgtype (self ):
218
218
conn = self .nodes [0 ].add_p2p_connection (P2PDataStore ())
219
219
with self .nodes [0 ].assert_debug_log (['HEADER ERROR - COMMAND' ]):
220
220
msg = msg_unrecognized (str_data = "d" )
221
221
msg = conn .build_message (msg )
222
- # Modify command
222
+ # Modify msgtype
223
223
msg = msg [:7 ] + b'\x00 ' + msg [7 + 1 :]
224
224
self .nodes [0 ].p2p .send_raw_message (msg )
225
225
conn .sync_with_ping (timeout = 1 )
0 commit comments