File tree Expand file tree Collapse file tree 5 files changed +34
-2
lines changed
Expand file tree Collapse file tree 5 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2929 Dashboard, documenting all endpoints and specific data fields used by the
3030 frontend ([ #1566 ] ( https://github.com/o1-labs/mina-rust/issues/1566 ) )
3131
32+ - ** Feature** : Add logging if initial peers are invalid
33+ ([ #1703 ] ( https://github.com/o1-labs/mina-rust/pull/1703 ) )
34+
3235### Fixed
3336
3437- ** Docker Compose** : Fix frontend black screen issue by changing environment
Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ pub enum ActionKind {
177177 EventSourceProcessEvents ,
178178 EventSourceWaitForEvents ,
179179 EventSourceWaitTimeout ,
180+ Exit ,
180181 ExternalSnarkWorkerCancelWork ,
181182 ExternalSnarkWorkerError ,
182183 ExternalSnarkWorkerKill ,
@@ -757,7 +758,7 @@ pub enum ActionKind {
757758}
758759
759760impl ActionKind {
760- pub const COUNT : u16 = 628 ;
761+ pub const COUNT : u16 = 629 ;
761762}
762763
763764impl std:: fmt:: Display for ActionKind {
Original file line number Diff line number Diff line change @@ -17,7 +17,32 @@ pub fn reducer(
1717 let meta = action. meta ( ) . clone ( ) ;
1818 match action. action ( ) {
1919 Action :: CheckTimeouts ( _) => {
20- if state. p2p . ready ( ) . is_some ( ) {
20+ if let Some ( p2p) = state. p2p . ready ( ) {
21+ if let Some ( kad_state) = & p2p. network . scheduler . discovery_state {
22+ if p2p. ready_peers ( ) . is_empty ( ) && kad_state. has_bootstraped {
23+ if let Some ( tip) = & state. transition_frontier . best_tip_breadcrumb ( ) {
24+ // TODO: this might need to change in future
25+ if tip. height ( ) == 296372 {
26+ let initial_peers = state
27+ . p2p
28+ . config ( )
29+ . initial_peers
30+ . iter ( )
31+ . map ( |opts| opts. to_string ( ) )
32+ . collect :: < Vec < _ > > ( )
33+ . join ( ", " ) ;
34+
35+ crate :: core:: error!(
36+ crate :: core:: log:: system_time( ) ;
37+ summary = "Exiting" ,
38+ error = "Invalid initial peers" ,
39+ initial_peers = initial_peers
40+ ) ;
41+ }
42+ }
43+ }
44+ }
45+
2146 if let Err ( error) =
2247 P2pState :: p2p_timeout_dispatch ( Substate :: new ( state, dispatcher) , & meta)
2348 {
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ impl super::P2pNetworkKadState {
133133 time : meta. time ( ) ,
134134 stats : bootstrap_state. stats . clone ( ) ,
135135 } ;
136+ state. has_bootstraped = true ;
136137 Ok ( ( ) )
137138 }
138139 ( _, P2pNetworkKademliaAction :: UpdateRoutingTable { peer_id, addrs } ) => {
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ pub struct P2pNetworkKadState {
6060 pub streams : StreamState < P2pNetworkKadStreamState > ,
6161 pub status : P2pNetworkKadStatus ,
6262 pub filter_addrs : bool ,
63+ pub has_bootstraped : bool ,
6364}
6465
6566impl Default for P2pNetworkKadState {
@@ -74,6 +75,7 @@ impl Default for P2pNetworkKadState {
7475 . ok ( )
7576 . and_then ( |s| s. parse ( ) . ok ( ) )
7677 . unwrap_or ( true ) ,
78+ has_bootstraped : false ,
7779 }
7880 }
7981}
You can’t perform that action at this time.
0 commit comments