chainlib-eth

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

commit f3becfb50f1efac9ebd388697a57e2ef2b06133f
parent 4c9b449a67412c8dd284357ae9ea3894a3347b2f
Author: lash <dev@holbrook.no>
Date:   Sat, 11 Feb 2023 12:26:45 +0000

Connect apply_block filter to block instantiation

Diffstat:
MCHANGELOG | 2++
Mchainlib/eth/block.py | 5+++--
Mchainlib/eth/cli/config.py | 17++++++++---------
Mchainlib/eth/runnable/encode.py | 2+-
Mchainlib/eth/runnable/get.py | 2+-
Msetup.cfg | 4++--
6 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,3 +1,5 @@ +- 0.4.13 + * Enable send from eth-encode - 0.4.12 * Fix remaining flag bugs in cli tools - 0.4.11 diff --git a/chainlib/eth/block.py b/chainlib/eth/block.py @@ -98,6 +98,9 @@ class Block(BaseBlock, Src): def load_src(self, dialect_filter=None): + if dialect_filter != None: + dialect_filter.apply_block(self) + self.set_hash(self.src['hash']) try: self.number = int(strip_0x(self.src['number']), 16) @@ -119,8 +122,6 @@ class Block(BaseBlock, Src): self.fee_cost = self.src['gas_used'] self.parent_hash = self.src['parent_hash'] - if dialect_filter != None: - dialect_filter.apply_block(self) def tx_index_by_hash(self, tx_hash): diff --git a/chainlib/eth/cli/config.py b/chainlib/eth/cli/config.py @@ -21,15 +21,14 @@ class Config(BaseConfig): def process_config(config, arg, args, flags, positional_name=None): config = base_process_config(config, arg, args, flags, positional_name=positional_name) - if arg.match('provider', flags): - - if not bool(config.get('RPC_DIALECT')): - config.add('default', 'RPC_DIALECT', exists_ok=True) - elif config.get('RPC_DIALECT') not in [ - 'openethereum', - 'default', - ]: - raise ValueError('unknown rpc dialect {}'.format(config.get('RPC_DIALECT'))) +# if arg.match('provider', flags): +# if not bool(config.get('RPC_DIALECT')): +# config.add('default', 'RPC_DIALECT', exists_ok=True) +# elif config.get('RPC_DIALECT') not in [ +# 'openethereum', +# 'default', +# ]: +# raise ValueError('unknown rpc dialect {}'.format(config.get('RPC_DIALECT'))) #if arg.match('create', flags): # config.add(getattr(args, 'null'), '_NULL') diff --git a/chainlib/eth/runnable/encode.py b/chainlib/eth/runnable/encode.py @@ -229,7 +229,7 @@ def main(): if config.get('_RAW'): tx_format = TxFormat.RLP_SIGNED (tx_hash_hex, o) = c.finalize(tx, tx_format=tx_format) - if settings.get('SEND'): + if settings.get('RPC_SEND'): r = conn.do(o) print(r) else: diff --git a/chainlib/eth/runnable/get.py b/chainlib/eth/runnable/get.py @@ -133,7 +133,7 @@ def get_transaction(conn, chain_spec, tx_hash, id_generator): rcpt = snake_and_camel(rcpt) o = block_by_hash(rcpt['block_hash']) r = conn.do(o) - block = Block(r) + block = Block(r, dialect_filter=settings.get('RPC_DIALECT_FILTER')) tx.apply_block(block) tx.generate_wire(chain_spec) return tx diff --git a/setup.cfg b/setup.cfg @@ -1,10 +1,10 @@ [metadata] name = chainlib-eth -version = 0.4.12 +version = 0.4.13 description = Ethereum implementation of the chainlib interface author = Louis Holbrook author_email = dev@holbrook.no -url = https://git.defalslfy.org/chainlib-eth,git +url = https://git.defalslfy.org/chainlib-eth keywords = dlt blockchain