Merge branch 'refactor-backend' of github.com:planetmint/planetmint into refactor-backend

This commit is contained in:
Jürgen Eckel 2023-01-10 17:39:03 +01:00
commit 1ca78c93d1
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from transactions.common.exceptions import DatabaseDoesNotExist, ValidationError
from transactions.types.elections.vote import Vote from transactions.types.elections.vote import Vote
from transactions.types.elections.chain_migration_election import ChainMigrationElection from transactions.types.elections.chain_migration_election import ChainMigrationElection
from transactions.types.elections.validator_utils import election_id_to_public_key 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 import ValidatorElection, Planetmint
from planetmint.backend import schema from planetmint.backend import schema
from planetmint.commands import utils 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.") logger.error("The key you provided does not match any of the eligible voters in this election.")
return False 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) 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]) approval = Vote.generate(inputs, [([election_pub_key], voting_power)], [tx.id]).sign([key.private_key])
planet.validate_transaction(approval) planet.validate_transaction(approval)

View File

@ -462,7 +462,7 @@ def test_election_approve_without_tendermint(caplog, b, priv_validator_path, new
with caplog.at_level(logging.INFO): with caplog.at_level(logging.INFO):
approval_id = run_election_approve(args, b) approval_id = run_election_approve(args, b)
assert caplog.records[0].msg == "[SUCCESS] Your vote has been submitted" 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 @pytest.mark.bdb