Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing gRPC node info issue #906

Merged
merged 10 commits into from
Jan 6, 2024
3 changes: 2 additions & 1 deletion www/grpc/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package grpc

import (
"context"
"fmt"
"unsafe"

"github.com/fxamacker/cbor/v2"
Expand Down Expand Up @@ -35,7 +36,7 @@ func (s *networkServer) GetNodeInfo(_ context.Context,

return &pactus.GetNodeInfoResponse{
Moniker: s.sync.Moniker(),
Agent: version.Agent(),
Agent: fmt.Sprintf("%v/reachability=%v", version.Agent(), s.net.ReachabilityStatus()),
kehiy marked this conversation as resolved.
Show resolved Hide resolved
PeerId: []byte(s.sync.SelfID()),
Reachability: s.net.ReachabilityStatus(),
Addrs: s.net.HostAddrs(),
Expand Down
3 changes: 2 additions & 1 deletion www/grpc/network_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package grpc

import (
"fmt"
"testing"

"github.com/libp2p/go-libp2p/core/peer"
Expand Down Expand Up @@ -47,7 +48,7 @@ func TestGetNodeInfo(t *testing.T) {
res, err := client.GetNodeInfo(tCtx, &pactus.GetNodeInfoRequest{})
assert.NoError(t, err)
assert.Nil(t, err)
assert.Equal(t, version.Agent(), res.Agent)
assert.Equal(t, fmt.Sprintf("%v/reachability=%v", version.Agent(), "Unknown"), res.Agent)
assert.Equal(t, []byte(tMockSync.SelfID()), res.PeerId)
assert.Equal(t, "test-moniker", res.Moniker)

Expand Down
Loading