4
0
mirror of git://holbrook.no/eth-monitor.git synced 2024-11-21 12:06:45 +01:00

Update syncer settings code calls

This commit is contained in:
lash 2022-05-14 20:58:21 +00:00
parent 28584aec35
commit a7814de98d
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 21 additions and 16 deletions

View File

@ -5,7 +5,7 @@ from .rules import (
to_config_names, to_config_names,
) )
def process_config(config, args, flags): def process_config(config, arg, args, flags):
arg_override = {} arg_override = {}
rules_args = rules_address_args + rules_data_args rules_args = rules_address_args + rules_data_args

View File

@ -19,7 +19,11 @@ from hexathon import (
strip_0x, strip_0x,
add_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.driver.chain_interface import ChainInterfaceDriver
from chainsyncer.error import SyncDone from chainsyncer.error import SyncDone
from chainsyncer.data import config_dir as chainsyncer_config_dir 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') config_dir = os.path.join(script_dir, '..', 'data', 'config')
arg_flags = ArgFlag() arg_flags = ArgFlag()
arg_flags = apply_flag_sync(arg_flags)
arg = Arg(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 = 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 = 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) 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:]) args = argparser.parse_args(sys.argv[1:])
if args.list_backends: if args.list_backends:
@ -74,17 +79,12 @@ if args.list_backends:
logg = process_log(args, logg) logg = process_log(args, logg)
base_config_dir = [
chainsyncer.cli.config_dir,
config_dir,
]
config = Config() config = Config()
config.add_schema_dir(config_dir) config.add_schema_dir(config_dir)
config.add_schema_dir(chainsyncer_config_dir) config.add_schema_dir(chainsyncer_config_dir)
config = process_config(config, arg, args, flags) config = process_config(config, arg, args, flags)
config = chainsyncer.cli.process_config(config, args, sync_flags) config = process_config_sync(config, arg, args, flags)
config = eth_monitor.cli.process_config(config, args, flags) config = eth_monitor.cli.process_config(config, arg, args, flags)
settings = ChainSettings() settings = ChainSettings()
settings = process_settings(settings, config) settings = process_settings(settings, config)

View File

@ -13,6 +13,7 @@ from eth_monitor.chain import EthChainInterface
from chainlib.eth.address import is_address from chainlib.eth.address import is_address
from eth_cache.rpc import CacheRPC from eth_cache.rpc import CacheRPC
from eth_cache.store.file import FileStore from eth_cache.store.file import FileStore
from chainsyncer.settings import process_sync_range
# local imports # local imports
@ -341,10 +342,14 @@ def process_sync_interface(settings, config):
def process_sync(settings, config): def process_sync(settings, config):
settings = process_sync_interface(settings, config) settings.set('SYNCER_INTERFACE', EthChainInterface())
settings = process_sync_backend(settings, config)
settings = process_sync_range(settings, config) settings = process_sync_range(settings, config)
return settings 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): def process_cache(settings, config):