def test_tracked_block_cleanup(self): from bxgateway.services.eth.eth_normal_block_cleanup_service import EthNormalBlockCleanupService self.node.block_cleanup_service = EthNormalBlockCleanupService( self.node, 1) tx_service = self.node.get_tx_service() for block_hash in self.block_queuing_service.iterate_recent_block_hashes( self.node.network.block_confirmations_count + 2): tx_service.track_seen_short_ids(block_hash, []) self.node.block_cleanup_service.block_cleanup_request = MagicMock() self.node._tracked_block_cleanup() self.node.block_cleanup_service.block_cleanup_request.assert_called_once( )
def build_block_cleanup_service(self) -> AbstractBlockCleanupService: if self.opts.use_extensions: from bxgateway.services.eth.eth_extension_block_cleanup_service import EthExtensionBlockCleanupService return EthExtensionBlockCleanupService(self, self.network_num) else: return EthNormalBlockCleanupService(self, self.network_num)
def _get_cleanup_service(self) -> AbstractEthBlockCleanupService: return EthNormalBlockCleanupService(self.node, 1)