Fix faulty receipt status parse

This commit is contained in:
nolash 2021-02-24 12:48:11 +01:00
parent 0918e44fb3
commit 17431dc000
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 12 additions and 6 deletions

View File

@ -210,10 +210,11 @@ class Tx:
def apply_receipt(self, rcpt):
if rcpt['status'] == 1:
status_number = int(strip_0x(rcpt['status']))
if status_number == 1:
self.status = Status.SUCCESS
elif rcpt['status'] == 0:
self.status = Status.PENDING
elif status_number == 0:
self.status = Status.ERROR
self.logs = rcpt['logs']
@ -222,13 +223,17 @@ class Tx:
def __str__(self):
return """from {}
return """hash {}
from {}
to {}
value {}
nonce {}
gasPrice {}
gasLimit {}
input {}""".format(
input {}
status {}
""".format(
self.hash,
self.outputs[0],
self.inputs[0],
self.value,
@ -236,4 +241,5 @@ input {}""".format(
self.gasPrice,
self.gasLimit,
self.payload,
self.status.name,
)

View File

@ -1,6 +1,6 @@
[metadata]
name = chainlib
version = 0.0.1a17
version = 0.0.1a18
description = Generic blockchain access library and tooling
author = Louis Holbrook
author_email = dev@holbrook.no