From 5734a2975687f4d019a65b89295d8d0db2befdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Mon, 12 Dec 2022 12:03:56 +0100 Subject: [PATCH] added version gateway to the push transactions API to only allow latest versions schemes to enter the APP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jürgen Eckel --- planetmint/web/views/transactions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/planetmint/web/views/transactions.py b/planetmint/web/views/transactions.py index 2660588..39fe56c 100644 --- a/planetmint/web/views/transactions.py +++ b/planetmint/web/views/transactions.py @@ -92,6 +92,13 @@ class TransactionListApi(Resource): except ValidationError as e: return make_error(400, "Invalid transaction ({}): {}".format(type(e).__name__, e)) else: + if tx_obj.version != Transaction.VERSION: + return make_error( + 401, + "Invalid transaction version: The transaction is valid, \ + but this node only accepts transaction with higher \ + schema version number.", + ) status_code, message = planet.write_transaction(tx_obj, mode) if status_code == 202: