From b14a092fb38aee796ca29018d1edaae58b5719b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Tue, 14 Feb 2023 22:38:51 +0100 Subject: [PATCH] fixed changed testcases and a bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jürgen Eckel --- planetmint/lib.py | 2 +- tests/validation/test_transaction_structure.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/planetmint/lib.py b/planetmint/lib.py index 13470df..113c033 100644 --- a/planetmint/lib.py +++ b/planetmint/lib.py @@ -684,7 +684,7 @@ class Planetmint(object): current_validators = self.get_validators_dict() # 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") def get_election_status(self, transaction): diff --git a/tests/validation/test_transaction_structure.py b/tests/validation/test_transaction_structure.py index 5fe2da0..456f887 100644 --- a/tests/validation/test_transaction_structure.py +++ b/tests/validation/test_transaction_structure.py @@ -168,7 +168,9 @@ def test_create_tx_no_fulfills(b, create_tx, alice): tx = create_tx.to_dict() tx["inputs"][0]["fulfills"] = {"transaction_id": "a" * 64, "output_index": 0} 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):