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

MX-13883: native auth server use api for fetching the block #124

Merged
merged 4 commits into from
Feb 20, 2023

Conversation

dragos-rebegea
Copy link
Contributor

No description provided.

args.Proxy = &testsCommon.ProxyStub{
GetHyperBlockByHashCalled: func(ctx context.Context, hash string) (*data.HyperBlock, error) {
return nil, expectedErr
args.HttpClientWrapper = &testsCommon.HTTPClientWrapperStub{
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


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)
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing comment on exported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

pubKeyConverter core.PubkeyConverter
getTimeHandler func() time.Time
httpClientWrapper authentication.HttpClientWrapper
apiNetworkAddress string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@AdoAdoAdo AdoAdoAdo merged commit cdfb304 into feat/freeze-account Feb 20, 2023
@sstanculeanu sstanculeanu deleted the MX-13883 branch February 20, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants