Skip to content

Commit 94696f2

Browse files
committed
feat(cli): mark sync-v2 parameters as safe and deprecate --x-* ones
1 parent d01aecc commit 94696f2

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

hathor/builder/cli_builder.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,17 @@ def create_manager(self, reactor: Reactor) -> HathorManager:
158158

159159
hostname = self.get_hostname()
160160
network = settings.NETWORK_NAME
161-
enable_sync_v1 = not self._args.x_sync_v2_only
162-
enable_sync_v2 = self._args.x_sync_v2_only or self._args.x_sync_bridge
161+
162+
arg_sync_v2_only = self._args.x_sync_v2_only or self._args.sync_v2_only
163+
if self._args.x_sync_v2_only:
164+
self.log.warn('--x-sync-v2-only is deprecated and will be removed, use --sync-v2-only instead')
165+
166+
arg_sync_bridge = self._args.x_sync_bridge or self._args.sync_bridge
167+
if self._args.x_sync_bridge:
168+
self.log.warn('--x-sync-bridge is deprecated and will be removed, use --sync-bridge instead')
169+
170+
enable_sync_v1 = not arg_sync_v2_only
171+
enable_sync_v2 = arg_sync_v2_only or arg_sync_bridge
163172

164173
pubsub = PubSubManager(reactor)
165174

hathor/cli/run_node.py

+5
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ def create_parser(cls) -> ArgumentParser:
108108
help='Enable support for running both sync protocols. DO NOT ENABLE, IT WILL BREAK.')
109109
v2args.add_argument('--x-sync-v2-only', action='store_true',
110110
help='Disable support for running sync-v1. DO NOT ENABLE, IT WILL BREAK.')
111+
# XXX: new safe arguments along side the unsafe --x- arguments so transition is easier
112+
v2args.add_argument('--sync-bridge', action='store_true',
113+
help='Enable support for running both sync protocols.')
114+
v2args.add_argument('--sync-v2-only', action='store_true',
115+
help='Disable support for running sync-v1.')
111116
parser.add_argument('--x-localhost-only', action='store_true', help='Only connect to peers on localhost')
112117
parser.add_argument('--x-rocksdb-indexes', action='store_true', help=SUPPRESS)
113118
parser.add_argument('--x-enable-event-queue', action='store_true', help='Enable event queue mechanism')

hathor/cli/run_node_args.py

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class RunNodeArgs(BaseModel, extra=Extra.allow):
6565
enable_crash_api: bool
6666
x_sync_bridge: bool
6767
x_sync_v2_only: bool
68+
sync_bridge: bool
69+
sync_v2_only: bool
6870
x_localhost_only: bool
6971
x_rocksdb_indexes: bool
7072
x_enable_event_queue: bool

0 commit comments

Comments
 (0)