fixed TX lookup issues due to different pools

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2023-01-10 09:22:22 +01:00
parent 810899f59c
commit 7fc69a0e8a
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View File

@ -195,7 +195,7 @@ def run_election_approve(args, planet):
""" """
key = load_node_key(args.sk) 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] voting_powers = [v.amount for v in tx.outputs if key.public_key in v.public_keys]
if len(voting_powers) > 0: if len(voting_powers) > 0:
voting_power = voting_powers[0] voting_power = voting_powers[0]

View File

@ -12,9 +12,12 @@ from argparse import Namespace
from planetmint.config import Config from planetmint.config import Config
from planetmint import ValidatorElection from planetmint import ValidatorElection
from planetmint.commands.planetmint import run_election_show 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.connection import Connection
from planetmint.backend.tarantool.const import TARANT_TABLE_GOVERNANCE
from planetmint.lib import Block from planetmint.lib import Block
from transactions.types.elections.chain_migration_election import ChainMigrationElection from transactions.types.elections.chain_migration_election import ChainMigrationElection
from tests.utils import generate_election, generate_validators 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): with caplog.at_level(logging.INFO):
election_id = run_election_new_upsert_validator(args, b) election_id = run_election_new_upsert_validator(args, b)
assert caplog.records[0].msg == "[SUCCESS] Submitted proposal with id: " + election_id 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 @pytest.mark.abci
def test_election_new_chain_migration_with_tendermint(b, priv_validator_path, user_sk, validators): 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={}) new_args = Namespace(action="new", election_type="migration", sk=priv_validator_path, config={})
election_id = run_election_new_chain_migration(new_args, b) 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 @pytest.mark.bdb
def test_election_new_chain_migration_without_tendermint(caplog, b, priv_validator_path, user_sk): 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): def mock_write(tx, mode):
b.store_bulk_transactions([tx]) b.store_bulk_transactions([tx])
return (202, "") return (202, "")
@ -377,7 +376,7 @@ def test_election_new_chain_migration_without_tendermint(caplog, b, priv_validat
with caplog.at_level(logging.INFO): with caplog.at_level(logging.INFO):
election_id = run_election_new_chain_migration(args, b) election_id = run_election_new_chain_migration(args, b)
assert caplog.records[0].msg == "[SUCCESS] Submitted proposal with id: " + election_id 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 @pytest.mark.bdb