Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_avalanche_peer_discovery.py
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
peer = get_ava_p2p_interface(node) | peer = get_ava_p2p_interface(node) | ||||
avahello = peer.wait_for_avahello().hello | avahello = peer.wait_for_avahello().hello | ||||
assert_equal(avahello.delegation.limited_proofid, 0) | assert_equal(avahello.delegation.limited_proofid, 0) | ||||
self.log.info( | self.log.info( | ||||
"A delegation with all zero limited id indicates that the peer has no proof") | "A delegation with all zero limited id indicates that the peer has no proof") | ||||
no_proof_peer = GetProofDataCountingInterface() | no_proof_peer = GetProofDataCountingInterface() | ||||
node.add_p2p_connection(no_proof_peer) | node.add_p2p_connection(no_proof_peer, wait_for_verack=True) | ||||
master_key = ECKey() | |||||
master_key.generate() | |||||
null_delegation = node.delegateavalancheproof( | |||||
f"{0:0{64}x}", | |||||
bytes_to_wif(privkey.get_bytes()), | |||||
master_key.get_pubkey().get_bytes().hex(), | |||||
) | |||||
no_proof_peer.send_avahello(null_delegation, privkey) | |||||
no_proof_peer.sync_send_with_ping() | no_proof_peer.sync_send_with_ping() | ||||
# No proof is requested | # No proof is requested | ||||
with p2p_lock: | with p2p_lock: | ||||
assert_equal(no_proof_peer.get_proof_data_count, 0) | assert_equal(no_proof_peer.get_proof_data_count, 0) | ||||
# Restart the node | # Restart the node | ||||
self.restart_node(0, self.extra_args[0] + [ | self.restart_node(0, self.extra_args[0] + [ | ||||
Show All 20 Lines | def run_test(self): | ||||
self.log.info( | self.log.info( | ||||
"Test the avahello signature with a generated delegation") | "Test the avahello signature with a generated delegation") | ||||
check_avahello([ | check_avahello([ | ||||
"-avaproof={}".format(proof), | "-avaproof={}".format(proof), | ||||
"-avamasterkey=cND2ZvtabDbJ1gucx9GWH6XT9kgTAqfb6cotPt5Q5CyxVDhid2EN" | "-avamasterkey=cND2ZvtabDbJ1gucx9GWH6XT9kgTAqfb6cotPt5Q5CyxVDhid2EN" | ||||
]) | ]) | ||||
master_key = ECKey() | |||||
master_key.generate() | |||||
limited_id = avalanche_proof_from_hex(proof).limited_proofid | limited_id = avalanche_proof_from_hex(proof).limited_proofid | ||||
delegation = node.delegateavalancheproof( | delegation = node.delegateavalancheproof( | ||||
f"{limited_id:0{64}x}", | f"{limited_id:0{64}x}", | ||||
bytes_to_wif(privkey.get_bytes()), | bytes_to_wif(privkey.get_bytes()), | ||||
master_key.get_pubkey().get_bytes().hex(), | master_key.get_pubkey().get_bytes().hex(), | ||||
) | ) | ||||
self.log.info("Test the avahello signature with a supplied delegation") | self.log.info("Test the avahello signature with a supplied delegation") | ||||
▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines |