Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abc619d7b2
|
||
|
|
42aa809500
|
||
|
|
e31367853c
|
||
|
|
9522729fa0
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ build/
|
|||||||
*.egg-info
|
*.egg-info
|
||||||
*.sqlite
|
*.sqlite
|
||||||
.coverage
|
.coverage
|
||||||
|
.chaind
|
||||||
|
|||||||
@@ -28,11 +28,12 @@ from chainqueue.cache import CacheTokenTx
|
|||||||
from chainlib.encode import TxHexNormalizer
|
from chainlib.encode import TxHexNormalizer
|
||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
from chaind.adapters.fs import ChaindFsAdapter
|
from chaind.adapters.fs import ChaindFsAdapter
|
||||||
|
from chaind.dispatch import DispatchProcessor
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from chaind.eth.dispatch import EthDispatcher
|
|
||||||
from chaind.eth.cache import EthCacheTx
|
from chaind.eth.cache import EthCacheTx
|
||||||
from chaind.eth.settings import ChaindEthSettings
|
from chaind.eth.settings import ChaindEthSettings
|
||||||
|
from chaind.eth.dispatch import EthDispatcher
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
@@ -66,33 +67,16 @@ settings.process(config)
|
|||||||
|
|
||||||
logg.debug('settings:\n{}'.format(settings))
|
logg.debug('settings:\n{}'.format(settings))
|
||||||
|
|
||||||
|
|
||||||
def process_outgoing(chain_spec, adapter, rpc, limit=100):
|
|
||||||
upcoming = adapter.upcoming()
|
|
||||||
logg.info('process {} {} {}'.format(chain_spec, adapter, rpc))
|
|
||||||
logg.info('upcoming {}'.format(upcoming))
|
|
||||||
i = 0
|
|
||||||
for tx_hash in upcoming:
|
|
||||||
if adapter.dispatch(tx_hash):
|
|
||||||
i += 1
|
|
||||||
return i
|
|
||||||
|
|
||||||
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
|
||||||
|
|
||||||
rpc = chainlib.eth.cli.Rpc()
|
rpc = chainlib.eth.cli.Rpc()
|
||||||
conn = rpc.connect_by_config(config)
|
conn = rpc.connect_by_config(config)
|
||||||
|
|
||||||
tx_normalizer = TxHexNormalizer().tx_hash
|
tx_normalizer = TxHexNormalizer().tx_hash
|
||||||
token_cache_store = CacheTokenTx(chain_spec, normalizer=tx_normalizer)
|
token_cache_store = CacheTokenTx(settings.get('CHAIN_SPEC'), normalizer=tx_normalizer)
|
||||||
dispatcher = EthDispatcher(conn)
|
|
||||||
queue_adapter = ChaindFsAdapter(
|
dispatcher = EthDispatcher(conn)
|
||||||
settings.get('CHAIN_SPEC'),
|
processor = DispatchProcessor(settings.get('CHAIN_SPEC'), settings.dir_for('queue'), dispatcher)
|
||||||
settings.dir_for('queue'),
|
ctrl = SessionController(settings, processor.process)
|
||||||
EthCacheTx,
|
|
||||||
dispatcher,
|
|
||||||
)
|
|
||||||
|
|
||||||
ctrl = SessionController(settings, queue_adapter, process_outgoing)
|
|
||||||
signal.signal(signal.SIGINT, ctrl.shutdown)
|
signal.signal(signal.SIGINT, ctrl.shutdown)
|
||||||
signal.signal(signal.SIGTERM, ctrl.shutdown)
|
signal.signal(signal.SIGTERM, ctrl.shutdown)
|
||||||
|
|
||||||
@@ -118,6 +102,14 @@ def main():
|
|||||||
ctrl.process(conn)
|
ctrl.process(conn)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
queue_adapter = ChaindFsAdapter(
|
||||||
|
settings.get('CHAIN_SPEC'),
|
||||||
|
settings.dir_for('queue'),
|
||||||
|
EthCacheTx,
|
||||||
|
dispatcher,
|
||||||
|
store_sync=False,
|
||||||
|
)
|
||||||
|
|
||||||
result_data = None
|
result_data = None
|
||||||
r = 0 # no error
|
r = 0 # no error
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import chainsyncer.cli
|
|||||||
import chaind.cli
|
import chaind.cli
|
||||||
from chaind.setup import Environment
|
from chaind.setup import Environment
|
||||||
from chaind.filter import StateFilter
|
from chaind.filter import StateFilter
|
||||||
from chaind.adapters.fs import ChaindFsAdapter
|
|
||||||
from chainlib.eth.block import block_latest
|
from chainlib.eth.block import block_latest
|
||||||
from hexathon import strip_0x
|
from hexathon import strip_0x
|
||||||
from chainsyncer.store.fs import SyncFsStore
|
from chainsyncer.store.fs import SyncFsStore
|
||||||
@@ -59,13 +58,7 @@ logg.debug('settings:\n{}'.format(settings))
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
queue_adapter = ChaindFsAdapter(
|
fltr = StateFilter(settings.get('CHAIN_SPEC'), settings.dir_for('queue'), EthCacheTx)
|
||||||
settings.get('CHAIN_SPEC'),
|
|
||||||
settings.dir_for('queue'),
|
|
||||||
EthCacheTx,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
fltr = StateFilter(queue_adapter)
|
|
||||||
sync_store = SyncFsStore(settings.get('SESSION_DATA_DIR'), session_id=settings.get('SESSION_ID'))
|
sync_store = SyncFsStore(settings.get('SESSION_DATA_DIR'), session_id=settings.get('SESSION_ID'))
|
||||||
sync_store.register(fltr)
|
sync_store.register(fltr)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
chaind~=0.1.3
|
chaind~=0.2.4
|
||||||
hexathon~=0.1.5
|
hexathon~=0.1.5
|
||||||
chainlib-eth~=0.1.1
|
chainlib-eth~=0.1.1
|
||||||
pyxdg~=0.27
|
pyxdg~=0.27
|
||||||
shep~=0.2.3
|
shep~=0.2.5
|
||||||
funga-eth~=0.6.0
|
funga-eth~=0.6.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chaind-eth
|
name = chaind-eth
|
||||||
version = 0.1.5
|
version = 0.2.2
|
||||||
description = Queue server for ethereum
|
description = Queue server for ethereum
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -27,7 +27,7 @@ while True:
|
|||||||
l = f.readline()
|
l = f.readline()
|
||||||
if l == '':
|
if l == '':
|
||||||
break
|
break
|
||||||
test_requirements.append(l.rstrip())
|
erc20_requirements.append(l.rstrip())
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from chainlib.chain import ChainSpec
|
|||||||
from chainqueue.cache import CacheTokenTx
|
from chainqueue.cache import CacheTokenTx
|
||||||
from chainlib.error import RPCException
|
from chainlib.error import RPCException
|
||||||
from chainlib.status import Status as TxStatus
|
from chainlib.status import Status as TxStatus
|
||||||
from chaind.unittest.common import TestChaindFsBase
|
from chaind.unittest.fs import TestChaindFsBase
|
||||||
from chaind.driver import QueueDriver
|
from chaind.driver import QueueDriver
|
||||||
from chaind.filter import StateFilter
|
from chaind.filter import StateFilter
|
||||||
from chainlib.eth.gas import Gas
|
from chainlib.eth.gas import Gas
|
||||||
|
|||||||
Reference in New Issue
Block a user