Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gateway/emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ func (g *EmulatorGateway) GetLatestProtocolStateSnapshot(ctx context.Context) ([
return snapshot, nil
}

func (g *EmulatorGateway) GetNodeVersionInfo(context.Context) (*flow.NodeVersionInfo, error) {
return &flow.NodeVersionInfo{}, nil
}

// SecureConnection placeholder func to complete gateway interface implementation
func (g *EmulatorGateway) SecureConnection() bool {
return false
Expand Down
1 change: 1 addition & 0 deletions gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Gateway interface {
GetEvents(context.Context, string, uint64, uint64) ([]flow.BlockEvents, error)
GetCollection(context.Context, flow.Identifier) (*flow.Collection, error)
GetLatestProtocolStateSnapshot(context.Context) ([]byte, error)
GetNodeVersionInfo(context.Context) (*flow.NodeVersionInfo, error)
Ping() error
WaitServer(context.Context) error
SecureConnection() bool
Expand Down
5 changes: 5 additions & 0 deletions gateway/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ func (g *GrpcGateway) GetLatestProtocolStateSnapshot(ctx context.Context) ([]byt
return g.client.GetLatestProtocolStateSnapshot(ctx)
}

// GetNodeVersionInfo returns version information for the access node.
func (g *GrpcGateway) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) {
return g.client.GetNodeVersionInfo(ctx)
}

// Ping is used to check if the access node is alive and healthy.
func (g *GrpcGateway) Ping() error {
ctx := context.Background()
Expand Down
30 changes: 30 additions & 0 deletions gateway/mocks/Gateway.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions gateway/mocks/gateway_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
GetSystemTransactionResultFunc = "GetSystemTransactionResult"
GetSystemTransactionWithIDFunc = "GetSystemTransactionWithID"
GetSystemTransactionResultWithIDFunc = "GetSystemTransactionResultWithID"
GetNodeVersionInfoFunc = "GetNodeVersionInfo"
)

type TestGateway struct {
Expand All @@ -66,6 +67,7 @@ type TestGateway struct {
GetSystemTransactionWithID *mock.Call
GetSystemTransactionResultWithID *mock.Call
GetLatestProtocolStateSnapshot *mock.Call
GetNodeVersionInfo *mock.Call
Ping *mock.Call
SecureConnection *mock.Call
}
Expand Down Expand Up @@ -145,6 +147,7 @@ func DefaultMockGateway() *TestGateway {
mock.AnythingOfType("flow.Identifier"),
mock.AnythingOfType("flow.Identifier"),
),
GetNodeVersionInfo: m.On(GetNodeVersionInfoFunc, ctxMock),
}

// default return values
Expand Down Expand Up @@ -181,6 +184,7 @@ func DefaultMockGateway() *TestGateway {
t.GetSystemTransactionResult.Return(tests.NewTransactionResult(nil), nil)
t.GetSystemTransactionWithID.Return(tests.NewTransaction(), nil)
t.GetSystemTransactionResultWithID.Return(tests.NewTransactionResult(nil), nil)
t.GetNodeVersionInfo.Return((*flow.NodeVersionInfo)(nil), nil)

return t
}
Loading