# Callback methods. Can be overridden by subclasses in individual test
# cases to provide custom message handling behaviour.
defon_open(self,conn):
self.connected=True
defon_close(self,conn):
self.connected=False
self.connection=None
defon_addr(self,conn,message):pass
defon_block(self,conn,message):pass
defon_blocktxn(self,conn,message):pass
defon_cmpctblock(self,conn,message):pass
defon_feefilter(self,conn,message):pass
defon_getaddr(self,conn,message):pass
defon_getblocks(self,conn,message):pass
defon_getblocktxn(self,conn,message):pass
defon_getdata(self,conn,message):pass
defon_getheaders(self,conn,message):pass
defon_headers(self,conn,message):pass
defon_mempool(self,conn):pass
defon_pong(self,conn,message):pass
defon_reject(self,conn,message):pass
defon_sendcmpct(self,conn,message):pass
defon_sendheaders(self,conn,message):pass
defon_tx(self,conn,message):pass
defon_inv(self,conn,message):
want=msg_getdata()
foriinmessage.inv:
ifi.type!=0:
want.inv.append(i)
iflen(want.inv):
conn.send_message(want)
defon_ping(self,conn,message):
conn.send_message(msg_pong(message.nonce))
defon_verack(self,conn,message):
self.verack_received=True
defon_version(self,conn,message):
assertmessage.nVersion>=MIN_VERSION_SUPPORTED,"Version {} received. Test framework only supports versions greater than {}".format(message.nVersion,MIN_VERSION_SUPPORTED)
# Callback methods. Can be overridden by subclasses in individual test
# cases to provide custom message handling behaviour.
defon_open(self,conn):
self.connected=True
defon_close(self,conn):
self.connected=False
self.connection=None
defon_addr(self,conn,message):pass
defon_block(self,conn,message):pass
defon_blocktxn(self,conn,message):pass
defon_cmpctblock(self,conn,message):pass
defon_feefilter(self,conn,message):pass
defon_getaddr(self,conn,message):pass
defon_getblocks(self,conn,message):pass
defon_getblocktxn(self,conn,message):pass
defon_getdata(self,conn,message):pass
defon_getheaders(self,conn,message):pass
defon_headers(self,conn,message):pass
defon_mempool(self,conn):pass
defon_pong(self,conn,message):pass
defon_reject(self,conn,message):pass
defon_sendcmpct(self,conn,message):pass
defon_sendheaders(self,conn,message):pass
defon_tx(self,conn,message):pass
defon_inv(self,conn,message):
want=msg_getdata()
foriinmessage.inv:
ifi.type!=0:
want.inv.append(i)
iflen(want.inv):
conn.send_message(want)
defon_ping(self,conn,message):
conn.send_message(msg_pong(message.nonce))
defon_verack(self,conn,message):
self.verack_received=True
defon_version(self,conn,message):
assertmessage.nVersion>=MIN_VERSION_SUPPORTED,"Version {} received. Test framework only supports versions greater than {}".format(message.nVersion,MIN_VERSION_SUPPORTED)