fixed changed testcases and a bug

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2023-02-14 22:38:51 +01:00
parent 2fc522dc77
commit b14a092fb3
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View File

@ -684,7 +684,7 @@ class Planetmint(object):
current_validators = self.get_validators_dict() current_validators = self.get_validators_dict()
# NOTE: change more than 1/3 of the current power is not allowed # NOTE: change more than 1/3 of the current power is not allowed
if Transaction.get_asset_array(transaction)[0]["data"]["power"] >= (1 / 3) * sum(current_validators.values()): if transaction.get_assets()[0]["data"]["power"] >= (1 / 3) * sum(current_validators.values()):
raise InvalidPowerChange("`power` change must be less than 1/3 of total power") raise InvalidPowerChange("`power` change must be less than 1/3 of total power")
def get_election_status(self, transaction): def get_election_status(self, transaction):

View File

@ -168,7 +168,9 @@ def test_create_tx_no_fulfills(b, create_tx, alice):
tx = create_tx.to_dict() tx = create_tx.to_dict()
tx["inputs"][0]["fulfills"] = {"transaction_id": "a" * 64, "output_index": 0} tx["inputs"][0]["fulfills"] = {"transaction_id": "a" * 64, "output_index": 0}
tx = Transaction.from_dict(tx).sign([alice.private_key]).to_dict() tx = Transaction.from_dict(tx).sign([alice.private_key]).to_dict()
validate_raises(tx) # Schema validation does not lookup inputs. this is only done by the node with DB/consensus context
#validate_raises(tx)
validate(tx)
def test_transfer_has_inputs(user_sk, signed_transfer_tx, alice): def test_transfer_has_inputs(user_sk, signed_transfer_tx, alice):