chainlib

Generic blockchain access library and tooling
Log | Files | Refs | README | LICENSE

commit 17431dc0008c7c6355cd0d127a24e20299203dcc
parent 0918e44fb3547a720d4fcb5640f0c32e6b468ff0
Author: nolash <dev@holbrook.no>
Date:   Wed, 24 Feb 2021 12:48:11 +0100

Fix faulty receipt status parse

Diffstat:
Mchainlib/eth/tx.py | 16+++++++++++-----
Msetup.cfg | 2+-
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/chainlib/eth/tx.py b/chainlib/eth/tx.py @@ -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, ) diff --git a/setup.cfg b/setup.cfg @@ -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