def __init__(self, chaindb: 'AsyncChainDB', account_db: BaseDB, root_hash: bytes, peer_pool: PeerPool, token: CancelToken = None) -> None: super().__init__(token) self.chaindb = chaindb self.peer_pool = peer_pool self.root_hash = root_hash self.scheduler = StateSync(root_hash, account_db) self._handler = PeerRequestHandler(self.chaindb, self.logger, self.cancel_token) self._peers_with_pending_requests: Dict[ETHPeer, float] = {} self._executor = get_asyncio_executor()
def __init__(self, token: CancelToken = None, loop: asyncio.AbstractEventLoop = None) -> None: self.events = ServiceEvents() self._run_lock = asyncio.Lock() self._child_services = [] self._finished_callbacks = [] self._loop = loop base_token = CancelToken(type(self).__name__, loop=loop) if token is None: self.cancel_token = base_token else: self.cancel_token = base_token.chain(token) self._executor = get_asyncio_executor()
def __init__(self, chain: AsyncChain, db: 'AsyncHeaderDB', peer_pool: PeerPool, token: CancelToken = None) -> None: super().__init__(token) self.chain = chain self.db = db self.peer_pool = peer_pool self._handler = PeerRequestHandler(self.db, self.logger, self.cancel_token) self._syncing = False self._sync_complete = asyncio.Event() self._sync_requests: asyncio.Queue[ HeaderRequestingPeer] = asyncio.Queue() self._new_headers: asyncio.Queue[Tuple[BlockHeader, ...]] = asyncio.Queue() self._executor = get_asyncio_executor()