File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2418,6 +2418,7 @@ func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) {
2418
2418
start := time .Now ().UTC ()
2419
2419
vi := common .GetVersionInfo ()
2420
2420
inSync , bestHeight , lastBlockTime , startSync := w .is .GetSyncState ()
2421
+ blockPeriod := w .is .GetAvgBlockPeriod ()
2421
2422
if ! inSync && ! w .is .InitialSync {
2422
2423
// if less than 5 seconds into syncing, return inSync=true to avoid short time not in sync reports that confuse monitoring
2423
2424
if startSync .Add (5 * time .Second ).After (start ) {
@@ -2435,6 +2436,13 @@ func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) {
2435
2436
inSync = false
2436
2437
inSyncMempool = false
2437
2438
}
2439
+ // for networks with stable block period, set not in sync if last sync more than 12 block periods ago
2440
+ if inSync && blockPeriod > 0 && w .chainType == bchain .ChainEthereumType {
2441
+ threshold := 12 * time .Duration (blockPeriod ) * time .Second
2442
+ if lastBlockTime .Add (threshold ).Before (time .Now ().UTC ()) {
2443
+ inSync = false
2444
+ }
2445
+ }
2438
2446
var columnStats []common.InternalStateColumn
2439
2447
var internalDBSize int64
2440
2448
if internal {
You can’t perform that action at this time.
0 commit comments