Skip to content

dot/rpc; implement RPC chain_getBlockHash#752

Merged
edwardmack merged 5 commits intodevelopmentfrom
ed/309_rpc_getBlockHash
Apr 7, 2020
Merged

dot/rpc; implement RPC chain_getBlockHash#752
edwardmack merged 5 commits intodevelopmentfrom
ed/309_rpc_getBlockHash

Conversation

@edwardmack
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
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