Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_rpc_avalancheproof.py
Show First 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.log.info("Bad proof should be rejected at startup") | self.log.info("Bad proof should be rejected at startup") | ||||
self.stop_node(0) | self.stop_node(0) | ||||
node.assert_start_raises_init_error( | node.assert_start_raises_init_error( | ||||
self.extra_args[0] + [ | self.extra_args[0] + [ | ||||
"-avasessionkey=0", | "-avasessionkey=0", | ||||
], | ], | ||||
expected_msg="Error: the avalanche session key is invalid", | expected_msg="Error: The avalanche session key is invalid.", | ||||
) | ) | ||||
node.assert_start_raises_init_error( | node.assert_start_raises_init_error( | ||||
self.extra_args[0] + [ | self.extra_args[0] + [ | ||||
"-avaproof={}".format(proof), | "-avaproof={}".format(proof), | ||||
], | ], | ||||
expected_msg="Error: the avalanche master key is missing for the avalanche proof", | expected_msg="Error: The avalanche master key is missing for the avalanche proof.", | ||||
) | ) | ||||
node.assert_start_raises_init_error( | node.assert_start_raises_init_error( | ||||
self.extra_args[0] + [ | self.extra_args[0] + [ | ||||
"-avaproof={}".format(proof), | "-avaproof={}".format(proof), | ||||
"-avamasterkey=0", | "-avamasterkey=0", | ||||
], | ], | ||||
expected_msg="Error: the avalanche master key is invalid", | expected_msg="Error: The avalanche master key is invalid.", | ||||
) | ) | ||||
def check_proof_init_error(proof, message): | def check_proof_init_error(proof, message): | ||||
node.assert_start_raises_init_error( | node.assert_start_raises_init_error( | ||||
self.extra_args[0] + [ | self.extra_args[0] + [ | ||||
"-avaproof={}".format(proof), | "-avaproof={}".format(proof), | ||||
"-avamasterkey=cND2ZvtabDbJ1gucx9GWH6XT9kgTAqfb6cotPt5Q5CyxVDhid2EN", | "-avamasterkey=cND2ZvtabDbJ1gucx9GWH6XT9kgTAqfb6cotPt5Q5CyxVDhid2EN", | ||||
], | ], | ||||
expected_msg="Error: " + message, | expected_msg="Error: " + message, | ||||
) | ) | ||||
check_proof_init_error(no_stake, | check_proof_init_error(no_stake, | ||||
"the avalanche proof has no stake") | "The avalanche proof has no stake.") | ||||
check_proof_init_error(dust, | check_proof_init_error(dust, | ||||
"the avalanche proof stake is too low") | "The avalanche proof stake is too low.") | ||||
check_proof_init_error(dust2, | check_proof_init_error(dust2, | ||||
"the avalanche proof stake is too low") | "The avalanche proof stake is too low.") | ||||
check_proof_init_error(duplicate_stake, | check_proof_init_error(duplicate_stake, | ||||
"the avalanche proof has duplicated stake") | "The avalanche proof has duplicated stake.") | ||||
check_proof_init_error(bad_sig, | check_proof_init_error(bad_sig, | ||||
"the avalanche proof has invalid stake signatures") | "The avalanche proof has invalid stake signatures.") | ||||
if self.is_wallet_compiled(): | if self.is_wallet_compiled(): | ||||
# The too many utxos case creates a proof which is that large that it | # The too many utxos case creates a proof which is that large that it | ||||
# cannot fit on the command line | # cannot fit on the command line | ||||
append_config(node.datadir, ["avaproof={}".format(too_many_utxos)]) | append_config(node.datadir, ["avaproof={}".format(too_many_utxos)]) | ||||
node.assert_start_raises_init_error( | node.assert_start_raises_init_error( | ||||
self.extra_args[0] + [ | self.extra_args[0] + [ | ||||
"-avamasterkey=cND2ZvtabDbJ1gucx9GWH6XT9kgTAqfb6cotPt5Q5CyxVDhid2EN", | "-avamasterkey=cND2ZvtabDbJ1gucx9GWH6XT9kgTAqfb6cotPt5Q5CyxVDhid2EN", | ||||
], | ], | ||||
expected_msg="Error: the avalanche proof has too many utxos", | expected_msg="Error: The avalanche proof has too many utxos.", | ||||
match=ErrorMatch.PARTIAL_REGEX, | match=ErrorMatch.PARTIAL_REGEX, | ||||
) | ) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
AvalancheProofTest().main() | AvalancheProofTest().main() |