mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 06:25:45 +00:00
Merge branch 'refactor-backend' of github.com:planetmint/planetmint into refactor-backend
This commit is contained in:
commit
1ca78c93d1
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user