-
Notifications
You must be signed in to change notification settings - Fork 12
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
MX-13883: native auth server use api for fetching the block #124
Conversation
args.Proxy = &testsCommon.ProxyStub{ | ||
GetHyperBlockByHashCalled: func(ctx context.Context, hash string) (*data.HyperBlock, error) { | ||
return nil, expectedErr | ||
args.HttpClientWrapper = &testsCommon.HTTPClientWrapperStub{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should also update test name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
authentication/native/server.go
Outdated
|
||
func (server *authServer) getBlockByHash(ctx context.Context, hash string) (*data.Block, error) { | ||
var block data.Block | ||
buff, code, err := server.httpClientWrapper.GetHTTP(ctx, server.apiNetworkAddress+"/blocks/"+hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract "/blocks/" in a constant then the full path concatenation in a local var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,23 @@ | |||
package data | |||
|
|||
type Block struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the api block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can define only the used fields by the native auth.
I think timestamp is the only one we need? as the hash we already give on the API call and we don't check it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,23 @@ | |||
package data | |||
|
|||
type Block struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing comment on exported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
authentication/native/server.go
Outdated
pubKeyConverter core.PubkeyConverter | ||
getTimeHandler func() time.Time | ||
httpClientWrapper authentication.HttpClientWrapper | ||
apiNetworkAddress string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
No description provided.