@@ -442,6 +442,32 @@ def __repr__(self):
442442 return "msg_pong(0x%x)" % (self .nonce ,)
443443
444444
445+ class msg_reject (MsgSerializable ):
446+ command = b"reject"
447+
448+ def __init__ (self , protover = PROTO_VERSION ):
449+ super (msg_reject , self ).__init__ (protover )
450+ self .message = b'(Message Unitialized)'
451+ self .ccode = b'\0 '
452+ self .reason = b'(Reason Unitialized)'
453+
454+ @classmethod
455+ def msg_deser (cls , f , protover = PROTO_VERSION ):
456+ c = cls ()
457+ c .message = VarStringSerializer .stream_deserialize (f )
458+ c .ccode = struct .unpack (b"<c" , ser_read (f ,1 ))[0 ]
459+ c .reason = VarStringSerializer .stream_deserialize (f )
460+ return c
461+
462+ def msg_ser (self , f ):
463+ VarStringSerializer .stream_serialize (self .message , f )
464+ f .write (struct .pack (b"<c" , self .ccode ))
465+ VarStringSerializer .stream_serialize (self .reason , f )
466+
467+ def __repr__ (self ):
468+ return "msg_reject(messsage=%s, ccode=%s, reason=%s)" % (self .message , self .ccode , self .reason )
469+
470+
445471class msg_mempool (MsgSerializable ):
446472 command = b"mempool"
447473
@@ -461,7 +487,7 @@ def __repr__(self):
461487msg_classes = [msg_version , msg_verack , msg_addr , msg_alert , msg_inv ,
462488 msg_getdata , msg_notfound , msg_getblocks , msg_getheaders ,
463489 msg_headers , msg_tx , msg_block , msg_getaddr , msg_ping ,
464- msg_pong , msg_mempool ]
490+ msg_pong , msg_reject , msg_mempool ]
465491
466492messagemap = {}
467493for cls in msg_classes :
0 commit comments