eth-monitor

Monitor and cache ethereum transactions with match filters
git clone git://git.defalsify.org/eth-monitor.git
Log | Files | Refs | README | LICENSE

commit a7814de98d6dbfd49f05bd4c6e8b77ee5ac4e9fe
parent 28584aec3503afe30de4f94fd975e663bcebb44e
Author: lash <dev@holbrook.no>
Date:   Sat, 14 May 2022 20:58:21 +0000

Update syncer settings code calls

Diffstat:
Meth_monitor/cli/config.py | 2+-
Meth_monitor/runnable/sync.py | 26+++++++++++++-------------
Meth_monitor/settings.py | 9+++++++--
3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/eth_monitor/cli/config.py b/eth_monitor/cli/config.py @@ -5,7 +5,7 @@ from .rules import ( to_config_names, ) -def process_config(config, args, flags): +def process_config(config, arg, args, flags): arg_override = {} rules_args = rules_address_args + rules_data_args diff --git a/eth_monitor/runnable/sync.py b/eth_monitor/runnable/sync.py @@ -19,7 +19,11 @@ from hexathon import ( strip_0x, add_0x, ) -#from chainsyncer.store.fs import SyncFsStore +from chainsyncer.cli.arg import ( + apply_arg as apply_arg_sync, + apply_flag as apply_flag_sync, + ) +from chainsyncer.cli.config import process_config as process_config_sync from chainsyncer.driver.chain_interface import ChainInterfaceDriver from chainsyncer.error import SyncDone from chainsyncer.data import config_dir as chainsyncer_config_dir @@ -50,17 +54,18 @@ script_dir = os.path.realpath(os.path.dirname(__file__)) config_dir = os.path.join(script_dir, '..', 'data', 'config') arg_flags = ArgFlag() +arg_flags = apply_flag_sync(arg_flags) + arg = Arg(arg_flags) -flags = arg_flags.STD_BASE_READ | arg_flags.PROVIDER | arg_flags.CHAIN_SPEC | arg_flags.VERYVERBOSE +arg = apply_arg_sync(arg) + +flags = arg_flags.STD_BASE_READ | arg_flags.PROVIDER | arg_flags.CHAIN_SPEC | arg_flags.VERYVERBOSE | arg_flags.SYNC_RANGE_EXT | arg_flags.STATE argparser = chainlib.eth.cli.ArgumentParser() -argparser.add_argument('--list-backends', dest='list_backends', action='store_true', help='List built-in store backends') argparser = process_args(argparser, arg, flags) +argparser.add_argument('--list-backends', dest='list_backends', action='store_true', help='List built-in store backends') eth_monitor.cli.process_args(argparser, arg, flags) -sync_flags = chainsyncer.cli.SyncFlag.RANGE | chainsyncer.cli.SyncFlag.HEAD -chainsyncer.cli.process_flags(argparser, sync_flags) - args = argparser.parse_args(sys.argv[1:]) if args.list_backends: @@ -74,17 +79,12 @@ if args.list_backends: logg = process_log(args, logg) -base_config_dir = [ - chainsyncer.cli.config_dir, - config_dir, - ] config = Config() config.add_schema_dir(config_dir) config.add_schema_dir(chainsyncer_config_dir) config = process_config(config, arg, args, flags) -config = chainsyncer.cli.process_config(config, args, sync_flags) -config = eth_monitor.cli.process_config(config, args, flags) - +config = process_config_sync(config, arg, args, flags) +config = eth_monitor.cli.process_config(config, arg, args, flags) settings = ChainSettings() settings = process_settings(settings, config) diff --git a/eth_monitor/settings.py b/eth_monitor/settings.py @@ -13,6 +13,7 @@ from eth_monitor.chain import EthChainInterface from chainlib.eth.address import is_address from eth_cache.rpc import CacheRPC from eth_cache.store.file import FileStore +from chainsyncer.settings import process_sync_range # local imports @@ -341,10 +342,14 @@ def process_sync_interface(settings, config): def process_sync(settings, config): - settings = process_sync_interface(settings, config) - settings = process_sync_backend(settings, config) + settings.set('SYNCER_INTERFACE', EthChainInterface()) settings = process_sync_range(settings, config) return settings +#def process_sync(settings, config): +# settings = process_sync_interface(settings, config) +# settings = process_sync_backend(settings, config) +# settings = process_sync_range(settings, config) +# return settings def process_cache(settings, config):