chainlib-eth

Ethereum implementation of the chainlib interface
Log | Files | Refs | README | LICENSE

commit 8bc5439de2a0c7c4f4de508a2d89549abf27f9eb
parent 54eb2b8a25083c3695b0b4c52ccd92e69e0cdb78
Author: lash <dev@holbrook.no>
Date:   Tue,  2 Apr 2024 12:19:07 +0100

Handle missing block author, fix pysha break

Diffstat:
Mchainlib/eth/block.py | 28++++++++++++++++++++--------
Mrequirements.txt | 2+-
Msetup.cfg | 2+-
3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/chainlib/eth/block.py b/chainlib/eth/block.py @@ -98,6 +98,25 @@ class Block(BaseBlock, Src): super(Block, self).__init__(src=src, dialect_filter=dialect_filter) + def __parse_author(self, src): + author = None + try: + author = self.src['author'] + except KeyError: + pass + if author: + return author + + try: + author = self.src['miner'] + except KeyError: + pass + if author: + return author + + return self.src['coinbase'] + + def load_src(self, dialect_filter=None): if dialect_filter != None: dialect_filter.apply_block(self) @@ -114,14 +133,7 @@ class Block(BaseBlock, Src): except TypeError: self.timestamp = int(self.src['timestamp']) - try: - self.author = self.src['author'] - except KeyError: - self.author = self.src['miner'] - - self.fee_limit = self.src['gas_limit'] - self.fee_cost = self.src['gas_used'] - self.parent_hash = self.src['parent_hash'] + self.author = self.__parse_author(self.src) def tx_by_index(self, idx, dialect_filter=eth_dialect_filter): diff --git a/requirements.txt b/requirements.txt @@ -1,4 +1,4 @@ -funga-eth~=0.7.5 +funga-eth~=0.8.0 safe-pysha3==1.0.4 hexathon~=0.1.7 websocket-client==0.57.0 diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainlib-eth -version = 0.5.3 +version = 0.6.0 description = Ethereum implementation of the chainlib interface author = Louis Holbrook author_email = dev@holbrook.no