Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_compactproofs.py
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
class CompactProofsTest(BitcoinTestFramework): | class CompactProofsTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
self.extra_args = [[ | self.extra_args = [[ | ||||
'-enableavalanche=1', | '-enableavalanche=1', | ||||
'-avaproofstakeutxoconfirmations=1', | '-avaproofstakeutxoconfirmations=1', | ||||
'-avacooldown=0', | '-avacooldown=0', | ||||
'-enableavalanchepeerdiscovery=1', | |||||
]] * self.num_nodes | ]] * self.num_nodes | ||||
def setup_network(self): | def setup_network(self): | ||||
# Don't connect the nodes | # Don't connect the nodes | ||||
self.setup_nodes() | self.setup_nodes() | ||||
@staticmethod | @staticmethod | ||||
def received_avaproofs(peer): | def received_avaproofs(peer): | ||||
▲ Show 20 Lines • Show All 575 Lines • ▼ Show 20 Lines | def test_send_inbound_getavaproofs_until_quorum_is_established(self): | ||||
# Periodic send will include the inbound as well | # Periodic send will include the inbound as well | ||||
current_total = count_getavaproofs([inbound, outbound]) | current_total = count_getavaproofs([inbound, outbound]) | ||||
while count_getavaproofs([inbound]) == 0: | while count_getavaproofs([inbound]) == 0: | ||||
node.mockscheduler(AVALANCHE_MAX_PERIODIC_NETWORKING_INTERVAL) | node.mockscheduler(AVALANCHE_MAX_PERIODIC_NETWORKING_INTERVAL) | ||||
self.wait_until(lambda: count_getavaproofs( | self.wait_until(lambda: count_getavaproofs( | ||||
[inbound, outbound]) > current_total) | [inbound, outbound]) > current_total) | ||||
current_total = count_getavaproofs([inbound, outbound]) | current_total = count_getavaproofs([inbound, outbound]) | ||||
# Connect the minimum amount of stake | # Connect the minimum amount of stake and nodes | ||||
privkey, proof = gen_proof(node) | for _ in range(8): | ||||
assert node.addavalanchenode( | node.add_p2p_connection(AvaP2PInterface(node)) | ||||
inbound.nodeid, | self.wait_until(lambda: node.getavalancheinfo()['active'] is True) | ||||
privkey.get_pubkey().get_bytes().hex(), | |||||
proof.serialize().hex()) | |||||
assert_equal(node.getavalancheinfo()['active'], True) | |||||
# From now only the outbound is requested | # From now only the outbound is requested | ||||
count_inbound = count_getavaproofs([inbound]) | count_inbound = count_getavaproofs([inbound]) | ||||
for _ in range(20): | for _ in range(20): | ||||
node.mockscheduler(AVALANCHE_MAX_PERIODIC_NETWORKING_INTERVAL) | node.mockscheduler(AVALANCHE_MAX_PERIODIC_NETWORKING_INTERVAL) | ||||
self.wait_until(lambda: count_getavaproofs( | self.wait_until(lambda: count_getavaproofs( | ||||
[inbound, outbound]) > current_total) | [inbound, outbound]) > current_total) | ||||
current_total = count_getavaproofs([inbound, outbound]) | current_total = count_getavaproofs([inbound, outbound]) | ||||
Show All 20 Lines |