From df783712ecfd491d5d5c852598e59d15cbb544de Mon Sep 17 00:00:00 2001 From: Fabian Schuh Date: Thu, 1 Sep 2016 17:16:12 +0200 Subject: [PATCH] [transactions] Fix Unknown op error and incorrect handling of 'extensions' --- graphenebase/operations.py | 6 +++--- graphenebase/signedtransactions.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/graphenebase/operations.py b/graphenebase/operations.py index d1055fe1..fcfe9164 100644 --- a/graphenebase/operations.py +++ b/graphenebase/operations.py @@ -70,10 +70,10 @@ def __init__(self, op) : self.opId = op[0] name = self.getOperationNameForId(self.opId) else: - self.opId = self.operations().get(op[0]) + self.opId = self.operations().get(op[0], None) name = op[0] - if not self.opId: - raise("Unknown operation") + if self.opId is None: + raise ValueError("Unknown operation") self.name = name[0].upper() + name[1:] # klassname try: klass = self._getklass(self.name) diff --git a/graphenebase/signedtransactions.py b/graphenebase/signedtransactions.py index c314a31c..7802e64d 100644 --- a/graphenebase/signedtransactions.py +++ b/graphenebase/signedtransactions.py @@ -40,12 +40,14 @@ class Signed_Transaction(GrapheneObject) : """ def __init__(self, *args, **kwargs) : if isArgsThisClass(self, args): - self.data = args[0].data + self.data = args[0].data else: if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] if "extensions" not in kwargs: kwargs["extensions"] = Set([]) + elif not kwargs.get("extensions"): + kwargs["extensions"] = Set([]) if "signatures" not in kwargs: kwargs["signatures"] = Array([]) else: