From 50a81c8e50175cf71fffa05f40c63a1eaa720e07 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Tue, 10 Jan 2023 16:40:44 +0100 Subject: [PATCH] fixed schema validation errors Signed-off-by: Lorenz Herzberger --- planetmint/commands/planetmint.py | 4 +++- tests/commands/test_commands.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/planetmint/commands/planetmint.py b/planetmint/commands/planetmint.py index 2a25979..c8b4a9c 100644 --- a/planetmint/commands/planetmint.py +++ b/planetmint/commands/planetmint.py @@ -21,6 +21,7 @@ from transactions.common.exceptions import DatabaseDoesNotExist, ValidationError from transactions.types.elections.vote import Vote from transactions.types.elections.chain_migration_election import ChainMigrationElection from transactions.types.elections.validator_utils import election_id_to_public_key +from transactions.common.transaction import Transaction from planetmint import ValidatorElection, Planetmint from planetmint.backend import schema from planetmint.commands import utils @@ -203,7 +204,8 @@ def run_election_approve(args, planet): logger.error("The key you provided does not match any of the eligible voters in this election.") return False - inputs = [i for i in tx.inputs if key.public_key in i.owners_before] + tx_converted = Transaction.from_dict(tx.to_dict(), True) + inputs = [i for i in tx_converted.to_inputs() if key.public_key in i.owners_before] election_pub_key = election_id_to_public_key(tx.id) approval = Vote.generate(inputs, [([election_pub_key], voting_power)], [tx.id]).sign([key.private_key]) planet.validate_transaction(approval) diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index b698105..92dab5f 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -462,7 +462,7 @@ def test_election_approve_without_tendermint(caplog, b, priv_validator_path, new with caplog.at_level(logging.INFO): approval_id = run_election_approve(args, b) assert caplog.records[0].msg == "[SUCCESS] Your vote has been submitted" - assert b.get_transaction(approval_id) + assert b.get_transaction(approval_id, TARANT_TABLE_GOVERNANCE) @pytest.mark.bdb