mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-23 22:15:44 +00:00
blackified
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
6a7153f21f
commit
962244b7ee
@ -81,9 +81,7 @@ class ApplicationLogic(BaseApplication):
|
|||||||
chain_id = known_chain["chain_id"]
|
chain_id = known_chain["chain_id"]
|
||||||
|
|
||||||
if known_chain["is_synced"]:
|
if known_chain["is_synced"]:
|
||||||
msg = (
|
msg = f"Got invalid InitChain ABCI request ({genesis}) - the chain {chain_id} is already synced."
|
||||||
f"Got invalid InitChain ABCI request ({genesis}) - the chain {chain_id} is already synced."
|
|
||||||
)
|
|
||||||
logger.error(msg)
|
logger.error(msg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if chain_id != genesis.chain_id:
|
if chain_id != genesis.chain_id:
|
||||||
|
|||||||
@ -61,9 +61,7 @@ class Validator:
|
|||||||
if tx.operation != Transaction.COMPOSE:
|
if tx.operation != Transaction.COMPOSE:
|
||||||
asset_id = tx.get_asset_id(input_txs)
|
asset_id = tx.get_asset_id(input_txs)
|
||||||
if asset_id != Transaction.read_out_asset_id(tx):
|
if asset_id != Transaction.read_out_asset_id(tx):
|
||||||
raise AssetIdMismatch(
|
raise AssetIdMismatch(("The asset id of the input does not match the asset id of the transaction"))
|
||||||
("The asset id of the input does not match the asset id of the transaction")
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
asset_ids = Transaction.get_asset_ids(input_txs)
|
asset_ids = Transaction.get_asset_ids(input_txs)
|
||||||
if Transaction.read_out_asset_id(tx) in asset_ids:
|
if Transaction.read_out_asset_id(tx) in asset_ids:
|
||||||
@ -105,7 +103,9 @@ class Validator:
|
|||||||
|
|
||||||
if output_amount != input_amount:
|
if output_amount != input_amount:
|
||||||
raise AmountError(
|
raise AmountError(
|
||||||
"The amount used in the inputs `{}` needs to be same as the amount used in the outputs `{}`".format(input_amount, output_amount)
|
"The amount used in the inputs `{}` needs to be same as the amount used in the outputs `{}`".format(
|
||||||
|
input_amount, output_amount
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -207,7 +207,7 @@ class Validator:
|
|||||||
self.validate_validator_election(transaction)
|
self.validate_validator_election(transaction)
|
||||||
|
|
||||||
return transaction
|
return transaction
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_same_topology(current_topology, election_topology):
|
def is_same_topology(current_topology, election_topology):
|
||||||
voters = {}
|
voters = {}
|
||||||
|
|||||||
@ -112,7 +112,7 @@ def run_election(args):
|
|||||||
|
|
||||||
b = Validator()
|
b = Validator()
|
||||||
abci_rpc = ABCI_RPC()
|
abci_rpc = ABCI_RPC()
|
||||||
|
|
||||||
if args.action == "show":
|
if args.action == "show":
|
||||||
run_election_show(args, b)
|
run_election_show(args, b)
|
||||||
else:
|
else:
|
||||||
@ -190,7 +190,7 @@ def run_election_new_chain_migration(args, planet, abci_rpc):
|
|||||||
return create_new_election(args.sk, planet, ChainMigrationElection, [{"data": {}}], abci_rpc)
|
return create_new_election(args.sk, planet, ChainMigrationElection, [{"data": {}}], abci_rpc)
|
||||||
|
|
||||||
|
|
||||||
def run_election_approve(args, validator: Validator, abci_rpc : ABCI_RPC):
|
def run_election_approve(args, validator: Validator, abci_rpc: ABCI_RPC):
|
||||||
"""Approve an election
|
"""Approve an election
|
||||||
|
|
||||||
:param args: dict
|
:param args: dict
|
||||||
|
|||||||
@ -131,16 +131,12 @@ DEFAULT_LOGGING_CONFIG = {
|
|||||||
"formatters": {
|
"formatters": {
|
||||||
"console": {
|
"console": {
|
||||||
"class": "logging.Formatter",
|
"class": "logging.Formatter",
|
||||||
"format": (
|
"format": ("[%(asctime)s] [%(levelname)s] (%(name)s) %(message)s (%(processName)-10s - pid: %(process)d)"),
|
||||||
"[%(asctime)s] [%(levelname)s] (%(name)s) %(message)s (%(processName)-10s - pid: %(process)d)"
|
|
||||||
),
|
|
||||||
"datefmt": "%Y-%m-%d %H:%M:%S",
|
"datefmt": "%Y-%m-%d %H:%M:%S",
|
||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"class": "logging.Formatter",
|
"class": "logging.Formatter",
|
||||||
"format": (
|
"format": ("[%(asctime)s] [%(levelname)s] (%(name)s) %(message)s (%(processName)-10s - pid: %(process)d)"),
|
||||||
"[%(asctime)s] [%(levelname)s] (%(name)s) %(message)s (%(processName)-10s - pid: %(process)d)"
|
|
||||||
),
|
|
||||||
"datefmt": "%Y-%m-%d %H:%M:%S",
|
"datefmt": "%Y-%m-%d %H:%M:%S",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user