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

Public Blockchain.getTotalDifficulty() method #956

Merged
merged 3 commits into from
Nov 16, 2020
Merged

Conversation

holgerd77
Copy link
Member

Intended to be included in the rc.1 release.

Addresses comment from @jochem-brouwer from here #923 (comment) to make Blockchain._getTd() public. Function is renamed to getTotalDifficulty() for better clarity, CHANGELOG entry has been added and the blockchain docs rebuild.

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #956 (7a9b9bb) into master (7765fba) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

Flag Coverage Δ
block 77.69% <100.00%> (ø)
blockchain 77.39% <100.00%> (ø)
common 91.87% <ø> (ø)
ethash 82.08% <ø> (ø)
tx 86.04% <ø> (-0.22%) ⬇️
vm 87.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

const td = await (<any>blockchain)._getTd(genesis.hash(), new BN(0))
st.ok(td.eq(genesis.header.difficulty), 'should perform _getTd correctly')
// cast the blockchain as <any> in order to get access to the private getTotalDifficulty
const td = await (<any>blockchain).getTotalDifficulty(genesis.hash(), new BN(0))
Copy link
Member

Choose a reason for hiding this comment

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

Don't have to cast here as any anymore, but won't let this be a blocker

Copy link
Member

@jochem-brouwer jochem-brouwer left a comment

Choose a reason for hiding this comment

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

One small non-blocking comment, looks great, thanks! 😄

@holgerd77 holgerd77 merged commit 11eb16f into master Nov 16, 2020
@holgerd77 holgerd77 deleted the public-td-method branch November 16, 2020 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants