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

dot/rpc; implement RPC chain_getBlockHash #752

Merged
merged 5 commits into from
Apr 7, 2020

Conversation

edwardmack
Copy link
Member

Changes

  • Implement RPC function chain_getBlockHash
  • Create alias chain_getHead for chain_getBlockHash
  • Created tests for these functions

Tests:

go test ./dot/rpc/...

Issues:

Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

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

looks good! great work :)

return stateSrvc
}

func loadTestBlocks(gh common.Hash, bs *state.BlockState) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

there's another test function in state called addBlocksToState where you can specify the depth (the branching part of that function probably isn't too relevant here) that might be useful in the future for adding more than 2 blocks

Copy link
Member Author

Choose a reason for hiding this comment

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

excellent, I thought there may be something, but I didn't look deeply enough. Will come in handy.

Copy link
Contributor

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Nice work! Looks good to me.

Number: big.NewInt(0),
StateRoot: "0x03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314",
ExtrinsicsRoot: "0x03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314",
ParentHash: "0xdbfdd87392d9ee52f499610582737daceecf83dc3ad7946fcadeb01c86e1ef75",
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just a comment to explain where this and the other test hashes are coming from?

@edwardmack edwardmack merged commit deeebc6 into development Apr 7, 2020
@edwardmack edwardmack deleted the ed/309_rpc_getBlockHash branch April 7, 2020 17:47
ryanchristo pushed a commit that referenced this pull request Jun 24, 2020
* implement chain_getBlockHash

* added tests for chain_getBlockHash

* lint cleanup

* cleanup comments
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