Skip to content

Commit

Permalink
Add IsNetworkHealthy flag to InfoResNodeStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Mar 19, 2024
1 parent 091b492 commit b6fcc35
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions api/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion nodeclient/http_api_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit b6fcc35

Please sign in to comment.