Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Incremental Optimization(s) on BlockBroadcaster #911

Merged

Conversation

smatthewenglish
Copy link
Contributor

PR description

--> adapt BlockBroadcaster to use send method on EthPeer

--> adapt EthProtocolMamnager to utilize BlockBroadcaster to disseminate newly mined block

Fixed Issue(s)

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

LGTM.

if (!totalDifficulty.isPresent()) {
final Optional<UInt256> maybeTotalDifficulty =
blockchain.getTotalDifficultyByHash(block.getHash());
if (!maybeTotalDifficulty.isPresent()) {
throw new IllegalStateException(
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this was pretty like this to start with but while you're here: blockchain.getTotalDifficultyByHash(block.getHash()).orElseThrow(() -> new IllegalStateException(...)) would be simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, for sure. I'll try to keep that pattern in mind in the future, it's not the first time you've given me this feedback

@smatthewenglish smatthewenglish merged commit 3d01ebd into PegaSysEng:master Feb 19, 2019
rain-on pushed a commit to rain-on/pantheon that referenced this pull request Feb 20, 2019
--> adapt `BlockBroadcaster` to use `send` method on `EthPeer`

--> adapt `EthProtocolMamnager` to utilize `BlockBroadcaster` to disseminate newly mined block
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants