From b6fcc3585c99c391ec5addff1496cbbb4368dd0f Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 19 Mar 2024 12:40:32 +0100 Subject: [PATCH] Add `IsNetworkHealthy` flag to `InfoResNodeStatus` --- api/core.go | 2 ++ api/core_test.go | 3 +++ nodeclient/http_api_client_test.go | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/core.go b/api/core.go index b8d5946e1..088e9c7f7 100644 --- a/api/core.go +++ b/api/core.go @@ -483,6 +483,8 @@ type ( InfoResNodeStatus struct { // Whether the node is healthy. IsHealthy bool `serix:""` + // Whether the network is healthy (finalization is not delayed). + IsNetworkHealthy bool `serix:""` // The accepted tangle time. AcceptedTangleTime time.Time `serix:""` // The relative accepted tangle time. diff --git a/api/core_test.go b/api/core_test.go index f62a3d1e1..f0c92ba7f 100644 --- a/api/core_test.go +++ b/api/core_test.go @@ -23,6 +23,7 @@ func Test_CoreAPIDeSerialize(t *testing.T) { Version: "2.0.0", Status: &api.InfoResNodeStatus{ IsHealthy: false, + IsNetworkHealthy: false, AcceptedTangleTime: time.Unix(1690879505, 0).UTC(), RelativeAcceptedTangleTime: time.Unix(1690879505, 0).UTC(), ConfirmedTangleTime: time.Unix(1690879505, 0).UTC(), @@ -301,6 +302,7 @@ func Test_CoreAPIJSONSerialization(t *testing.T) { Version: "2.0.0", Status: &api.InfoResNodeStatus{ IsHealthy: false, + IsNetworkHealthy: false, AcceptedTangleTime: time.Unix(1690879505, 0).UTC(), RelativeAcceptedTangleTime: time.Unix(1690879505, 0).UTC(), ConfirmedTangleTime: time.Unix(1690879505, 0).UTC(), @@ -330,6 +332,7 @@ func Test_CoreAPIJSONSerialization(t *testing.T) { "version": "2.0.0", "status": { "isHealthy": false, + "isNetworkHealthy": false, "acceptedTangleTime": "1690879505000000000", "relativeAcceptedTangleTime": "1690879505000000000", "confirmedTangleTime": "1690879505000000000", diff --git a/nodeclient/http_api_client_test.go b/nodeclient/http_api_client_test.go index 722308cb8..117381f90 100644 --- a/nodeclient/http_api_client_test.go +++ b/nodeclient/http_api_client_test.go @@ -105,10 +105,11 @@ func nodeClient(t *testing.T) *nodeclient.Client { ts := time.Now() originInfo := &api.InfoResponse{ - Name: "HORNET", + Name: "iota-core", Version: "1.0.0", Status: &api.InfoResNodeStatus{ IsHealthy: true, + IsNetworkHealthy: true, LatestAcceptedBlockSlot: tpkg.RandSlot(), LatestConfirmedBlockSlot: tpkg.RandSlot(), LatestFinalizedSlot: iotago.SlotIndex(142857),