From b86920491baaea0c9cfa5079641a5f03b7dfccfb Mon Sep 17 00:00:00 2001
From: a
Date: Tue, 5 Dec 2023 03:48:47 -0600
Subject: [PATCH 1/2] ok
---
cmd/rpcdaemon/health/check_time.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/rpcdaemon/health/check_time.go b/cmd/rpcdaemon/health/check_time.go
index d604521656c..e78f8aee858 100644
--- a/cmd/rpcdaemon/health/check_time.go
+++ b/cmd/rpcdaemon/health/check_time.go
@@ -27,7 +27,7 @@ func checkTime(
timestamp = int(cs)
}
}
- if timestamp > seconds {
+ if timestamp < seconds {
return fmt.Errorf("%w: got ts: %d, need: %d", errTimestampTooOld, timestamp, seconds)
}
From 62294d6d924c1e98c731d4e602031e4776659b42 Mon Sep 17 00:00:00 2001
From: a
Date: Sat, 9 Dec 2023 23:48:13 -0600
Subject: [PATCH 2/2] fix test
---
cmd/rpcdaemon/health/health_test.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmd/rpcdaemon/health/health_test.go b/cmd/rpcdaemon/health/health_test.go
index a843923edfe..f46146a4feb 100644
--- a/cmd/rpcdaemon/health/health_test.go
+++ b/cmd/rpcdaemon/health/health_test.go
@@ -245,7 +245,7 @@ func TestProcessHealthcheckIfNeeded_HeadersTests(t *testing.T) {
netApiResponse: hexutil.Uint(1),
netApiError: nil,
ethApiBlockResult: map[string]interface{}{
- "timestamp": time.Now().Add(1 * time.Second).Unix(),
+ "timestamp": uint64(time.Now().Add(-10 * time.Second).Unix()),
},
ethApiBlockError: nil,
ethApiSyncingResult: false,
@@ -264,7 +264,7 @@ func TestProcessHealthcheckIfNeeded_HeadersTests(t *testing.T) {
netApiResponse: hexutil.Uint(1),
netApiError: nil,
ethApiBlockResult: map[string]interface{}{
- "timestamp": uint64(time.Now().Add(1 * time.Hour).Unix()),
+ "timestamp": uint64(time.Now().Add(-1 * time.Hour).Unix()),
},
ethApiBlockError: nil,
ethApiSyncingResult: false,
@@ -319,7 +319,7 @@ func TestProcessHealthcheckIfNeeded_HeadersTests(t *testing.T) {
netApiResponse: hexutil.Uint(10),
netApiError: nil,
ethApiBlockResult: map[string]interface{}{
- "timestamp": time.Now().Add(1 * time.Second).Unix(),
+ "timestamp": uint64(time.Now().Add(1 * time.Second).Unix()),
},
ethApiBlockError: nil,
ethApiSyncingResult: false,