Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_rpc_avalancheproof.py
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
node.delegateavalancheproof, | node.delegateavalancheproof, | ||||
limited_id_hex, | limited_id_hex, | ||||
bytes_to_wif(bytes(32)), | bytes_to_wif(bytes(32)), | ||||
random_pubkey, | random_pubkey, | ||||
) | ) | ||||
# Invalid delegation | # Invalid delegation | ||||
bad_dg = AvalancheDelegation() | bad_dg = AvalancheDelegation() | ||||
assert_raises_rpc_error(-8, "The supplied delegation does not match the proof", | assert_raises_rpc_error(-8, "The delegation does not match the proof", | ||||
node.delegateavalancheproof, | node.delegateavalancheproof, | ||||
limited_id_hex, | limited_id_hex, | ||||
bytes_to_wif(privkey.get_bytes()), | bytes_to_wif(privkey.get_bytes()), | ||||
random_pubkey, | random_pubkey, | ||||
bad_dg.serialize().hex(), | bad_dg.serialize().hex(), | ||||
) | ) | ||||
# Still invalid, but with a matching proofid | # Still invalid, but with a matching proofid | ||||
bad_dg.limited_proofid = proofobj.limited_proofid | bad_dg.limited_proofid = proofobj.limited_proofid | ||||
bad_dg.proof_master = proofobj.master | bad_dg.proof_master = proofobj.master | ||||
bad_dg.levels = [AvalancheDelegationLevel()] | bad_dg.levels = [AvalancheDelegationLevel()] | ||||
assert_raises_rpc_error(-8, "The supplied delegation is not valid", | assert_raises_rpc_error(-8, "The delegation is invalid", | ||||
node.delegateavalancheproof, | node.delegateavalancheproof, | ||||
limited_id_hex, | limited_id_hex, | ||||
bytes_to_wif(privkey.get_bytes()), | bytes_to_wif(privkey.get_bytes()), | ||||
random_pubkey, | random_pubkey, | ||||
bad_dg.serialize().hex(), | bad_dg.serialize().hex(), | ||||
) | ) | ||||
# Wrong privkey, match the proof but does not match the delegation | # Wrong privkey, match the proof but does not match the delegation | ||||
assert_raises_rpc_error(-8, "The supplied private key does not match the delegation", | assert_raises_rpc_error(-5, "The private key does not match the delegation", | ||||
node.delegateavalancheproof, | node.delegateavalancheproof, | ||||
limited_id_hex, | limited_id_hex, | ||||
bytes_to_wif(privkey.get_bytes()), | bytes_to_wif(privkey.get_bytes()), | ||||
random_pubkey, | random_pubkey, | ||||
delegation, | delegation, | ||||
) | ) | ||||
# Delegation not hex | # Delegation not hex | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |