Skip to content

Commit d6aac22

Browse files
author
Arjan Zijderveld
committed
Graceful fallback to Bytes if decoding of OpaqueCall fails
1 parent dfcf676 commit d6aac22

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

scalecodec/types.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def __init__(self, data, type_mapping=None, **kwargs):
425425
def process(self):
426426

427427
result = {}
428+
print('Struct', self.__class__.__name__)
428429
for key, data_type in self.type_mapping:
429430
if data_type is None:
430431
data_type = 'Null'
@@ -1187,15 +1188,17 @@ def process_encode(self, value):
11871188
return super().process_encode(str(call_obj.encode(value)))
11881189

11891190
def process(self):
1190-
super().process()
1191-
1192-
call_obj = self.get_decoder_class(
1193-
type_string='Call',
1194-
data=ScaleBytes('0x{}'.format(self.raw_value)),
1195-
metadata=self.metadata
1196-
)
1197-
1198-
return call_obj.process()
1191+
value = super().process()
1192+
try:
1193+
call_obj = self.get_decoder_class(
1194+
type_string='Call',
1195+
data=ScaleBytes('0x{}'.format(self.raw_value)),
1196+
metadata=self.metadata
1197+
)
1198+
1199+
return call_obj.process()
1200+
except:
1201+
return value
11991202

12001203

12011204
class MultiAccountId(GenericAccountId):

0 commit comments

Comments
 (0)