Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/avatools.py
Show All 17 Lines | from .messages import ( | ||||
CInv, | CInv, | ||||
CTransaction, | CTransaction, | ||||
FromHex, | FromHex, | ||||
TCPAvalancheResponse, | TCPAvalancheResponse, | ||||
ToHex, | ToHex, | ||||
hash256, | hash256, | ||||
msg_avahello, | msg_avahello, | ||||
msg_avapoll, | msg_avapoll, | ||||
msg_avaproof, | |||||
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 202 Lines • ▼ Show 20 Lines | def send_avahello(self, delegation_hex: str, delegated_privkey: ECKey): | ||||
msg = msg_avahello() | msg = msg_avahello() | ||||
msg.hello.delegation = delegation | msg.hello.delegation = delegation | ||||
msg.hello.sig = delegated_privkey.sign_schnorr(local_sighash) | msg.hello.sig = delegated_privkey.sign_schnorr(local_sighash) | ||||
self.send_message(msg) | self.send_message(msg) | ||||
return delegation.proofid | return delegation.proofid | ||||
def send_avaproof(self, proof_hex: str) -> int: | |||||
proof = FromHex(AvalancheProof(), proof_hex) | |||||
msg = msg_avaproof() | |||||
msg.proof = proof | |||||
self.send_message(msg) | |||||
return proof.proofid | |||||
def get_ava_p2p_interface( | def get_ava_p2p_interface( | ||||
node: TestNode, | node: TestNode, | ||||
services=NODE_NETWORK | NODE_AVALANCHE) -> AvaP2PInterface: | services=NODE_NETWORK | NODE_AVALANCHE) -> AvaP2PInterface: | ||||
"""Build and return an AvaP2PInterface connected to the specified | """Build and return an AvaP2PInterface connected to the specified | ||||
TestNode. | TestNode. | ||||
""" | """ | ||||
n = AvaP2PInterface() | n = AvaP2PInterface() | ||||
Show All 20 Lines |