Skip to content

Commit 63c6733

Browse files
committed
Get rid of TrinityStartupEvent
1 parent fc7ed34 commit 63c6733

File tree

3 files changed

+11
-27
lines changed

3 files changed

+11
-27
lines changed

trinity/extensibility/events.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ class BaseEvent:
2929
pass
3030

3131

32-
class TrinityStartupEvent(BaseEvent):
33-
"""
34-
Broadcasted when Trinity is starting.
35-
"""
36-
def __init__(self, args: Namespace, trinity_config: TrinityConfig) -> None:
37-
self.args = args
38-
self.trinity_config = trinity_config
39-
40-
4132
class PluginStartedEvent(BaseEvent):
4233
"""
4334
Broadcasted when a plugin was started

trinity/main.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@
4949
PluginManager,
5050
SharedProcessScope,
5151
)
52-
from trinity.extensibility.events import (
53-
TrinityStartupEvent
54-
)
5552
from trinity.plugins.registry import (
5653
ENABLED_PLUGINS
5754
)
@@ -270,10 +267,7 @@ def trinity_boot(args: Namespace,
270267
)
271268

272269
plugin_manager.prepare(args, trinity_config, extra_kwargs)
273-
plugin_manager.broadcast(TrinityStartupEvent(
274-
args,
275-
trinity_config
276-
))
270+
277271
try:
278272
loop = asyncio.get_event_loop()
279273
loop.run_forever()
@@ -361,10 +355,6 @@ def launch_node(args: Namespace, trinity_config: TrinityConfig, endpoint: Endpoi
361355

362356
plugin_manager = setup_plugins(SharedProcessScope(endpoint))
363357
plugin_manager.prepare(args, trinity_config)
364-
plugin_manager.broadcast(TrinityStartupEvent(
365-
args,
366-
trinity_config
367-
))
368358

369359
node = NodeClass(plugin_manager, trinity_config)
370360
loop = node.get_event_loop()

trinity/plugins/builtin/tx_pool/plugin.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
)
2828
from trinity.extensibility.events import (
2929
ResourceAvailableEvent,
30-
TrinityStartupEvent,
3130
)
3231
from trinity.plugins.builtin.tx_pool.pool import (
3332
TxPool,
@@ -57,12 +56,16 @@ def configure_parser(self, arg_parser: ArgumentParser, subparser: _SubParsersAct
5756
)
5857

5958
def handle_event(self, activation_event: BaseEvent) -> None:
60-
if isinstance(activation_event, TrinityStartupEvent):
61-
light_mode = activation_event.args.sync_mode == SYNC_LIGHT
62-
self.is_enabled = activation_event.args.tx_pool and not light_mode
63-
if activation_event.args.tx_pool and light_mode:
64-
self.logger.error('The transaction pool is not yet available in light mode')
65-
self.context.shutdown_host()
59+
60+
light_mode = self.context.chain_config.sync_mode == SYNC_LIGHT
61+
self.is_enabled = self.context.args.tx_pool and not light_mode
62+
63+
unsupported = self.context.args.tx_pool and light_mode
64+
65+
if unsupported:
66+
self.logger.error('The transaction pool is not yet available in light mode')
67+
self.context.shutdown_host()
68+
6669
if isinstance(activation_event, ResourceAvailableEvent):
6770
if activation_event.resource_type is ETHPeerPool:
6871
self.peer_pool, self.cancel_token = activation_event.resource

0 commit comments

Comments
 (0)