Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/avatools.py
Show All 23 Lines | from .messages import ( | ||||
TCPAvalancheResponse, | TCPAvalancheResponse, | ||||
ToHex, | ToHex, | ||||
calculate_shortid, | calculate_shortid, | ||||
hash256, | hash256, | ||||
msg_avahello, | msg_avahello, | ||||
msg_avapoll, | msg_avapoll, | ||||
msg_avaproof, | msg_avaproof, | ||||
msg_avaproofs, | msg_avaproofs, | ||||
msg_sendava, | |||||
msg_tcpavaresponse, | msg_tcpavaresponse, | ||||
) | ) | ||||
from .p2p import P2PInterface, p2p_lock | from .p2p import P2PInterface, p2p_lock | ||||
from .test_node import TestNode | from .test_node import TestNode | ||||
from .util import assert_equal, satoshi_round, wait_until_helper | from .util import assert_equal, satoshi_round, wait_until_helper | ||||
from .wallet_util import bytes_to_wif | from .wallet_util import bytes_to_wif | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | class AvaP2PInterface(P2PInterface): | ||||
def on_version(self, message): | def on_version(self, message): | ||||
super().on_version(message) | super().on_version(message) | ||||
# Save the nonce and extra entropy so they can be reused later. | # Save the nonce and extra entropy so they can be reused later. | ||||
self.remote_nonce = message.nNonce | self.remote_nonce = message.nNonce | ||||
self.remote_extra_entropy = message.nExtraEntropy | self.remote_extra_entropy = message.nExtraEntropy | ||||
self.send_message(msg_sendava()) | |||||
def on_avaresponse(self, message): | def on_avaresponse(self, message): | ||||
self.avaresponses.append(message.response) | self.avaresponses.append(message.response) | ||||
def on_avapoll(self, message): | def on_avapoll(self, message): | ||||
self.avapolls.append(message.poll) | self.avapolls.append(message.poll) | ||||
def on_avahello(self, message): | def on_avahello(self, message): | ||||
assert(self.avahello is None) | assert(self.avahello is None) | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |