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

Wired Mining into CliquePantheonController #22

Merged
merged 1 commit into from
Oct 11, 2018
Merged

Wired Mining into CliquePantheonController #22

merged 1 commit into from
Oct 11, 2018

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Oct 10, 2018

No description provided.


@Override
public void disable() {
LOGGER.trace("Clique Mining cannot be disabled.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this throw UnsupportedOperationException so the caller knows it's done nothing? Seems like it should at least be a WARN, although I'm not quite sure where this is called from.

@@ -78,7 +78,7 @@
private static final String MANDATORY_MODE_FORMAT_HELP = "<MODE>";

private static final Wei DEFAULT_MIN_TRANSACTION_GAS_PRICE = Wei.of(1000);
private static final BytesValue DEFAULT_EXTRA_DATA = BytesValue.EMPTY;
private static final BytesValue DEFAULT_EXTRA_DATA = BytesValue.wrap(new byte[32]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe extra data for main net is variable length so defaulting to EMPTY is definitely better there. Actually, it probably should default to the pantheon version identifier string based on https://github.com/ethereum/wiki/wiki/Default-Extra-Data-Standard but that's out of scope here.

Might be better to leave this default to EMPTY but automatically leftPad any extra data we get to make it 32 bytes?

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.

new SystemClock(),
protocolContext.getConsensusState().getVoteTallyCache(),
Util.publicKeyToAddress(nodeKeys.getPublicKey()),
15L), // TODO (tmm): This needs to come from
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably need to at least complete this comment but better would be to make it actually come from config. :)

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.

return new CliquePantheonController(
genesisConfig,
protocolContext,
ethProtocolManager,
synchronizer,
nodeKeys,
transactionPool,
kv::close);
() -> {
miningCoordinator.disable();
Copy link
Contributor

Choose a reason for hiding this comment

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

CliqueMiningCoordinator.disable() does nothing which suggests this shouldn't be called, but we definitely need to get mining to stop at shutdown time though. So maybe disable needs to actually stop mining?

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 - we now allow mining to be started and stopped.

Copy link
Contributor

@saltiniroberto saltiniroberto left a comment

Choose a reason for hiding this comment

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

LGTM

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.

@rain-on rain-on merged commit 6c8422d into PegaSysEng:master Oct 11, 2018
@rain-on rain-on deleted the clique_wired branch October 22, 2018 04:42
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.

5 participants