Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_avalanche_proof_voting.py
Show All 27 Lines | |||||
class AvalancheProofVotingTest(BitcoinTestFramework): | class AvalancheProofVotingTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.conflicting_proof_cooldown = 100 | self.conflicting_proof_cooldown = 100 | ||||
self.peer_replacement_cooldown = 2000 | self.peer_replacement_cooldown = 2000 | ||||
self.extra_args = [ | self.extra_args = [ | ||||
['-enableavalanche=1', | ['-enableavalanche=1', | ||||
'-avaproofstakeutxodustthreshold=1000000', | |||||
'-enableavalancheproofreplacement=1', | '-enableavalancheproofreplacement=1', | ||||
'-avaproofstakeutxoconfirmations=2', | '-avaproofstakeutxoconfirmations=2', | ||||
f'-avalancheconflictingproofcooldown={self.conflicting_proof_cooldown}', f'-avalanchepeerreplacementcooldown={self.peer_replacement_cooldown}', '-avacooldown=0', '-avastalevotethreshold=140', '-avastalevotefactor=1'], | f'-avalancheconflictingproofcooldown={self.conflicting_proof_cooldown}', f'-avalanchepeerreplacementcooldown={self.peer_replacement_cooldown}', '-avacooldown=0', '-avastalevotethreshold=140', '-avastalevotefactor=1'], | ||||
] | ] | ||||
self.supports_cli = False | self.supports_cli = False | ||||
# Build a fake quorum of nodes. | # Build a fake quorum of nodes. | ||||
def get_quorum(self, node): | def get_quorum(self, node): | ||||
▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | def update_tests(self, node): | ||||
self.send_proof(peer, proof_seq50) | self.send_proof(peer, proof_seq50) | ||||
assert_raises_rpc_error(-8, | assert_raises_rpc_error(-8, | ||||
"Proof not found", | "Proof not found", | ||||
node.getrawavalancheproof, | node.getrawavalancheproof, | ||||
f"{proofid_seq50:0{64}x}") | f"{proofid_seq50:0{64}x}") | ||||
def vote_tests(self, node): | def vote_tests(self, node): | ||||
self.restart_node(0, extra_args=['-enableavalanche=1', | self.restart_node(0, extra_args=['-enableavalanche=1', | ||||
'-avaproofstakeutxodustthreshold=1000000', | |||||
'-avaproofstakeutxoconfirmations=2', | '-avaproofstakeutxoconfirmations=2', | ||||
'-avacooldown=0', | '-avacooldown=0', | ||||
'-avalancheconflictingproofcooldown=0', | '-avalancheconflictingproofcooldown=0', | ||||
'-whitelist=noban@127.0.0.1', ]) | '-whitelist=noban@127.0.0.1', ]) | ||||
self.get_quorum(node) | self.get_quorum(node) | ||||
ava_node = get_ava_p2p_interface(node) | ava_node = get_ava_p2p_interface(node) | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | def stale_proof_tests(self, node): | ||||
assert repr(response.response.votes) == repr([ | assert repr(response.response.votes) == repr([ | ||||
AvalancheVote(AvalancheProofVoteResponse.UNKNOWN, proofid_seq1), | AvalancheVote(AvalancheProofVoteResponse.UNKNOWN, proofid_seq1), | ||||
AvalancheVote(AvalancheProofVoteResponse.ACTIVE, proofid_seq2)]) | AvalancheVote(AvalancheProofVoteResponse.ACTIVE, proofid_seq2)]) | ||||
def unorphan_poll_tests(self, node): | def unorphan_poll_tests(self, node): | ||||
# Restart the node with appropriate flags for this test | # Restart the node with appropriate flags for this test | ||||
self.restart_node(0, extra_args=[ | self.restart_node(0, extra_args=[ | ||||
'-enableavalanche=1', | '-enableavalanche=1', | ||||
'-avaproofstakeutxodustthreshold=1000000', | |||||
'-enableavalancheproofreplacement=1', | '-enableavalancheproofreplacement=1', | ||||
'-avaproofstakeutxoconfirmations=2', | '-avaproofstakeutxoconfirmations=2', | ||||
'-avalancheconflictingproofcooldown=0', | '-avalancheconflictingproofcooldown=0', | ||||
'-avacooldown=0', | '-avacooldown=0', | ||||
]) | ]) | ||||
self.quorum = self.get_quorum(node) | self.quorum = self.get_quorum(node) | ||||
peer = get_ava_p2p_interface(node) | peer = get_ava_p2p_interface(node) | ||||
Show All 16 Lines |