Add registry sanity check
This commit is contained in:
parent
7f3cfe9339
commit
5b67b2c82a
@ -101,14 +101,14 @@ class DispatchSyncer:
|
|||||||
LockEnum.QUEUE,
|
LockEnum.QUEUE,
|
||||||
tx['from'],
|
tx['from'],
|
||||||
],
|
],
|
||||||
queue=queue,
|
queue=config.get('CELERY_QUEUE'),
|
||||||
)
|
)
|
||||||
s_send = celery.signature(
|
s_send = celery.signature(
|
||||||
'cic_eth.eth.tx.send',
|
'cic_eth.eth.tx.send',
|
||||||
[
|
[
|
||||||
self.chain_spec.asdict(),
|
self.chain_spec.asdict(),
|
||||||
],
|
],
|
||||||
queue=queue,
|
queue=config.get('CELERY_QUEUE'),
|
||||||
)
|
)
|
||||||
s_check.link(s_send)
|
s_check.link(s_send)
|
||||||
t = s_check.apply_async()
|
t = s_check.apply_async()
|
||||||
|
@ -20,6 +20,7 @@ from hexathon import strip_0x
|
|||||||
import chainlib.eth.cli
|
import chainlib.eth.cli
|
||||||
import cic_eth.cli
|
import cic_eth.cli
|
||||||
from cic_eth.cli.chain import chain_interface
|
from cic_eth.cli.chain import chain_interface
|
||||||
|
from chainlib.eth.constant import ZERO_ADDRESS
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
#import common
|
#import common
|
||||||
@ -62,6 +63,11 @@ conn = rpc.connect_by_config(config)
|
|||||||
|
|
||||||
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
||||||
|
|
||||||
|
|
||||||
|
class NetworkError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# create signer (not currently in use, but needs to be accessible for custom traffic item generators)
|
# create signer (not currently in use, but needs to be accessible for custom traffic item generators)
|
||||||
signer = rpc.get_signer()
|
signer = rpc.get_signer()
|
||||||
@ -95,10 +101,14 @@ def main():
|
|||||||
|
|
||||||
# get relevant registry entries
|
# get relevant registry entries
|
||||||
token_registry = registry.lookup('TokenRegistry')
|
token_registry = registry.lookup('TokenRegistry')
|
||||||
|
if token_registry == ZERO_ADDRESS:
|
||||||
|
raise NetworkError('TokenRegistry value missing from contract registry {}'.format(config.get('CIC_REGISTRY_ADDRESS')))
|
||||||
logg.info('using token registry {}'.format(token_registry))
|
logg.info('using token registry {}'.format(token_registry))
|
||||||
token_cache = TokenRegistryCache(chain_spec, token_registry)
|
token_cache = TokenRegistryCache(chain_spec, token_registry)
|
||||||
|
|
||||||
account_registry = registry.lookup('AccountRegistry')
|
account_registry = registry.lookup('AccountRegistry')
|
||||||
|
if account_registry == ZERO_ADDRESS:
|
||||||
|
raise NetworkError('AccountRegistry value missing from contract registry {}'.format(config.get('CIC_REGISTRY_ADDRESS')))
|
||||||
logg.info('using account registry {}'.format(account_registry))
|
logg.info('using account registry {}'.format(account_registry))
|
||||||
account_cache = AccountRegistryCache(chain_spec, account_registry)
|
account_cache = AccountRegistryCache(chain_spec, account_registry)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user