@@ -89,31 +89,34 @@ class UnhealthinessReason(str, Enum):
89
89
# This is the interval to be used by the task to check if the node is synced
90
90
CHECK_SYNC_STATE_INTERVAL = 30 # seconds
91
91
92
- def __init__ (self ,
93
- reactor : Reactor ,
94
- * ,
95
- settings : HathorSettings ,
96
- pubsub : PubSubManager ,
97
- consensus_algorithm : ConsensusAlgorithm ,
98
- daa : DifficultyAdjustmentAlgorithm ,
99
- peer_id : PeerId ,
100
- tx_storage : TransactionStorage ,
101
- p2p_manager : ConnectionsManager ,
102
- event_manager : EventManager ,
103
- feature_service : FeatureService ,
104
- bit_signaling_service : BitSignalingService ,
105
- verification_service : VerificationService ,
106
- cpu_mining_service : CpuMiningService ,
107
- network : str ,
108
- execution_manager : ExecutionManager ,
109
- hostname : Optional [str ] = None ,
110
- wallet : Optional [BaseWallet ] = None ,
111
- capabilities : Optional [list [str ]] = None ,
112
- checkpoints : Optional [list [Checkpoint ]] = None ,
113
- rng : Optional [Random ] = None ,
114
- environment_info : Optional [EnvironmentInfo ] = None ,
115
- full_verification : bool = False ,
116
- enable_event_queue : bool = False ):
92
+ def __init__ (
93
+ self ,
94
+ reactor : Reactor ,
95
+ * ,
96
+ settings : HathorSettings ,
97
+ pubsub : PubSubManager ,
98
+ consensus_algorithm : ConsensusAlgorithm ,
99
+ daa : DifficultyAdjustmentAlgorithm ,
100
+ peer_id : PeerId ,
101
+ tx_storage : TransactionStorage ,
102
+ p2p_manager : ConnectionsManager ,
103
+ event_manager : EventManager ,
104
+ feature_service : FeatureService ,
105
+ bit_signaling_service : BitSignalingService ,
106
+ verification_service : VerificationService ,
107
+ cpu_mining_service : CpuMiningService ,
108
+ network : str ,
109
+ execution_manager : ExecutionManager ,
110
+ hostname : Optional [str ] = None ,
111
+ wallet : Optional [BaseWallet ] = None ,
112
+ capabilities : Optional [list [str ]] = None ,
113
+ checkpoints : Optional [list [Checkpoint ]] = None ,
114
+ rng : Optional [Random ] = None ,
115
+ environment_info : Optional [EnvironmentInfo ] = None ,
116
+ full_verification : bool = False ,
117
+ enable_event_queue : bool = False ,
118
+ peer_id_json_path : str | None = None ,
119
+ ) -> None :
117
120
"""
118
121
:param reactor: Twisted reactor which handles the mainloop and the events.
119
122
:param peer_id: Id of this node.
@@ -135,6 +138,7 @@ def __init__(self,
135
138
self ._settings = settings
136
139
self .daa = daa
137
140
self ._cmd_path : Optional [str ] = None
141
+ self ._peer_id_json_path = peer_id_json_path
138
142
139
143
self .log = logger .new ()
140
144
@@ -1173,6 +1177,11 @@ def get_cmd_path(self) -> Optional[str]:
1173
1177
"""Return the cmd path. If no cmd path is set, returns None."""
1174
1178
return self ._cmd_path
1175
1179
1180
+ def update_peer_id (self ) -> None :
1181
+ """Recreate this manager's PeerId from the json file, that may have changed."""
1182
+ if self ._peer_id_json_path :
1183
+ self .my_peer = PeerId .create_from_json_path (self ._peer_id_json_path )
1184
+
1176
1185
1177
1186
class ParentTxs (NamedTuple ):
1178
1187
""" Tuple where the `must_include` hash, when present (at most 1), must be included in a pair, and a list of hashes
0 commit comments