From 7fc69a0e8ac548ed1eb75cec17102dd4cb91fea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Tue, 10 Jan 2023 09:22:22 +0100 Subject: [PATCH] fixed TX lookup issues due to different pools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jürgen Eckel --- planetmint/commands/planetmint.py | 2 +- tests/commands/test_commands.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/planetmint/commands/planetmint.py b/planetmint/commands/planetmint.py index 5ad6030..2a25979 100644 --- a/planetmint/commands/planetmint.py +++ b/planetmint/commands/planetmint.py @@ -195,7 +195,7 @@ def run_election_approve(args, planet): """ key = load_node_key(args.sk) - tx = planet.get_transaction(args.election_id,TARANT_TABLE_GOVERNANCE) + tx = planet.get_transaction(args.election_id, TARANT_TABLE_GOVERNANCE) voting_powers = [v.amount for v in tx.outputs if key.public_key in v.public_keys] if len(voting_powers) > 0: voting_power = voting_powers[0] diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index ab2762a..b698105 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -12,9 +12,12 @@ from argparse import Namespace from planetmint.config import Config from planetmint import ValidatorElection from planetmint.commands.planetmint import run_election_show +from planetmint.commands.planetmint import run_election_new_chain_migration from planetmint.backend.connection import Connection +from planetmint.backend.tarantool.const import TARANT_TABLE_GOVERNANCE from planetmint.lib import Block from transactions.types.elections.chain_migration_election import ChainMigrationElection + from tests.utils import generate_election, generate_validators @@ -347,13 +350,11 @@ def test_election_new_upsert_validator_without_tendermint(caplog, b, priv_valida with caplog.at_level(logging.INFO): election_id = run_election_new_upsert_validator(args, b) assert caplog.records[0].msg == "[SUCCESS] Submitted proposal with id: " + election_id - assert b.get_transaction(election_id) + assert b.get_transaction(election_id, TARANT_TABLE_GOVERNANCE) @pytest.mark.abci def test_election_new_chain_migration_with_tendermint(b, priv_validator_path, user_sk, validators): - from planetmint.commands.planetmint import run_election_new_chain_migration - new_args = Namespace(action="new", election_type="migration", sk=priv_validator_path, config={}) election_id = run_election_new_chain_migration(new_args, b) @@ -363,8 +364,6 @@ def test_election_new_chain_migration_with_tendermint(b, priv_validator_path, us @pytest.mark.bdb def test_election_new_chain_migration_without_tendermint(caplog, b, priv_validator_path, user_sk): - from planetmint.commands.planetmint import run_election_new_chain_migration - def mock_write(tx, mode): b.store_bulk_transactions([tx]) return (202, "") @@ -377,7 +376,7 @@ def test_election_new_chain_migration_without_tendermint(caplog, b, priv_validat with caplog.at_level(logging.INFO): election_id = run_election_new_chain_migration(args, b) assert caplog.records[0].msg == "[SUCCESS] Submitted proposal with id: " + election_id - assert b.get_transaction(election_id) + assert b.get_transaction(election_id, TARANT_TABLE_GOVERNANCE) @pytest.mark.bdb