diff --git a/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreator.java b/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreator.java index 1647a31fd1..f3d0c0452a 100644 --- a/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreator.java +++ b/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreator.java @@ -3,6 +3,8 @@ package net.consensys.pantheon.consensus.clique.blockcreation; import net.consensys.pantheon.consensus.clique.CliqueBlockHashing; import net.consensys.pantheon.consensus.clique.CliqueContext; import net.consensys.pantheon.consensus.clique.CliqueExtraData; +import net.consensys.pantheon.consensus.common.VoteTally; +import net.consensys.pantheon.consensus.common.VoteType; import net.consensys.pantheon.crypto.SECP256K1; import net.consensys.pantheon.crypto.SECP256K1.KeyPair; import net.consensys.pantheon.ethereum.ProtocolContext; @@ -18,13 +20,16 @@ import net.consensys.pantheon.ethereum.core.Util; import net.consensys.pantheon.ethereum.core.Wei; import net.consensys.pantheon.ethereum.mainnet.ProtocolSchedule; import net.consensys.pantheon.ethereum.mainnet.ScheduleBasedBlockHashFunction; +import net.consensys.pantheon.util.bytes.BytesValue; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; import java.util.function.Function; public class CliqueBlockCreator extends AbstractBlockCreator { private final KeyPair nodeKeys; - private final ProtocolSchedule protocolSchedule; public CliqueBlockCreator( final Address coinbase, @@ -47,7 +52,6 @@ public class CliqueBlockCreator extends AbstractBlockCreator { Util.publicKeyToAddress(nodeKeys.getPublicKey()), parentHeader); this.nodeKeys = nodeKeys; - this.protocolSchedule = protocolSchedule; } /** @@ -64,11 +68,26 @@ public class CliqueBlockCreator extends AbstractBlockCreator { final BlockHashFunction blockHashFunction = ScheduleBasedBlockHashFunction.create(protocolSchedule); + final Optional optionalParentHeader = + protocolContext.getBlockchain().getBlockHeader(sealableBlockHeader.getParentHash()); + final CliqueContext cliqueContext = protocolContext.getConsensusState(); + final VoteTally voteTally = cliqueContext.getVoteTallyCache().getVoteTallyAtBlock(parentHeader); + + final Optional> vote = + cliqueContext + .getVoteProposer() + .getVote(Util.publicKeyToAddress(nodeKeys.getPublicKey()), voteTally); + + final long nonce = vote.map(Entry::getValue).map(VoteType::getNonceValue).orElse(0L); + final Address coinbase = + vote.map(Entry::getKey).orElse(Address.wrap(BytesValue.wrap(new byte[20]))); + final BlockHeaderBuilder builder = BlockHeaderBuilder.create() .populateFrom(sealableBlockHeader) .mixHash(Hash.ZERO) - .nonce(0) + .nonce(nonce) + .coinbase(coinbase) .blockHashFunction(blockHashFunction); final CliqueExtraData sealedExtraData = constructSignedExtraData(builder.buildBlockHeader()); diff --git a/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreatorTest.java b/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreatorTest.java index 4c275fc0e3..2c199fc3f2 100644 --- a/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreatorTest.java +++ b/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/blockcreation/CliqueBlockCreatorTest.java @@ -14,6 +14,7 @@ import net.consensys.pantheon.consensus.clique.TestHelpers; import net.consensys.pantheon.consensus.clique.VoteTallyCache; import net.consensys.pantheon.consensus.common.VoteProposer; import net.consensys.pantheon.consensus.common.VoteTally; +import net.consensys.pantheon.consensus.common.VoteType; import net.consensys.pantheon.crypto.SECP256K1.KeyPair; import net.consensys.pantheon.ethereum.ProtocolContext; import net.consensys.pantheon.ethereum.chain.GenesisConfig; @@ -58,6 +59,7 @@ public class CliqueBlockCreatorTest { private ProtocolContext protocolContext; private final MutableProtocolSchedule protocolSchedule = new CliqueProtocolSchedule(); + private VoteProposer voteProposer; @Before public void setup() { @@ -76,7 +78,9 @@ public class CliqueBlockCreatorTest { final VoteTallyCache voteTallyCache = mock(VoteTallyCache.class); when(voteTallyCache.getVoteTallyAtBlock(any())).thenReturn(new VoteTally(validatorList)); - final CliqueContext cliqueContext = new CliqueContext(voteTallyCache, new VoteProposer()); + voteProposer = new VoteProposer(); + final CliqueContext cliqueContext = new CliqueContext(voteTallyCache, voteProposer); + protocolContext = new ProtocolContext<>(blockchain, stateArchive, cliqueContext); // Add a block above the genesis @@ -114,4 +118,54 @@ public class CliqueBlockCreatorTest { assertThat(CliqueHelpers.getProposerOfBlock(createdBlock.getHeader())) .isEqualTo(proposerAddress); } + + @Test + public void insertsValidVoteIntoConstructedBlock() { + final CliqueExtraData extraData = + new CliqueExtraData(BytesValue.wrap(new byte[32]), null, validatorList); + final Address a1 = Address.fromHexString("5"); + voteProposer.auth(a1); + final Address coinbase = AddressHelpers.ofValue(1); + + final CliqueBlockCreator blockCreator = + new CliqueBlockCreator( + coinbase, + parent -> extraData.encode(), + new PendingTransactions(5), + protocolContext, + protocolSchedule, + gasLimit -> gasLimit, + proposerKeyPair, + Wei.ZERO, + blockchain.getChainHeadHeader()); + + final Block createdBlock = blockCreator.createBlock(0L); + assertThat(createdBlock.getHeader().getNonce()).isEqualTo(VoteType.ADD.getNonceValue()); + assertThat(createdBlock.getHeader().getCoinbase()).isEqualTo(a1); + } + + @Test + public void insertsNoVoteWhenAuthInValidators() { + final CliqueExtraData extraData = + new CliqueExtraData(BytesValue.wrap(new byte[32]), null, validatorList); + final Address a1 = Util.publicKeyToAddress(otherKeyPair.getPublicKey()); + voteProposer.auth(a1); + final Address coinbase = AddressHelpers.ofValue(1); + + final CliqueBlockCreator blockCreator = + new CliqueBlockCreator( + coinbase, + parent -> extraData.encode(), + new PendingTransactions(5), + protocolContext, + protocolSchedule, + gasLimit -> gasLimit, + proposerKeyPair, + Wei.ZERO, + blockchain.getChainHeadHeader()); + + final Block createdBlock = blockCreator.createBlock(0L); + assertThat(createdBlock.getHeader().getNonce()).isEqualTo(VoteType.DROP.getNonceValue()); + assertThat(createdBlock.getHeader().getCoinbase()).isEqualTo(Address.fromHexString("0")); + } } diff --git a/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/DiscardTest.java b/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/DiscardTest.java index e9f492785b..613c668f9b 100644 --- a/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/DiscardTest.java +++ b/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/DiscardTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import net.consensys.pantheon.consensus.common.VoteProposer; -import net.consensys.pantheon.consensus.common.VoteProposer.Vote; +import net.consensys.pantheon.consensus.common.VoteType; import net.consensys.pantheon.ethereum.core.Address; import net.consensys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import net.consensys.pantheon.ethereum.jsonrpc.internal.exception.InvalidJsonRpcParameters; @@ -80,7 +80,7 @@ public class DiscardTest { final JsonRpcResponse response = discard.response(requestWithParams(a0)); assertThat(proposer.get(a0)).isEqualTo(Optional.empty()); - assertThat(proposer.get(a1)).isEqualTo(Optional.of(Vote.AUTH)); + assertThat(proposer.get(a1)).isEqualTo(Optional.of(VoteType.ADD)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); diff --git a/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/ProposeTest.java b/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/ProposeTest.java index a17c51888f..b3d0d9b24e 100644 --- a/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/ProposeTest.java +++ b/consensus/clique/src/test/java/net/consensys/pantheon/consensus/clique/jsonrpc/methods/ProposeTest.java @@ -3,7 +3,7 @@ package net.consensys.pantheon.consensus.clique.jsonrpc.methods; import static org.assertj.core.api.Assertions.assertThat; import net.consensys.pantheon.consensus.common.VoteProposer; -import net.consensys.pantheon.consensus.common.VoteProposer.Vote; +import net.consensys.pantheon.consensus.common.VoteType; import net.consensys.pantheon.ethereum.core.Address; import net.consensys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import net.consensys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -27,7 +27,7 @@ public class ProposeTest { final JsonRpcResponse response = propose.response(requestWithParams(a0, true)); - assertThat(proposer.get(a0)).isEqualTo(Optional.of(Vote.AUTH)); + assertThat(proposer.get(a0)).isEqualTo(Optional.of(VoteType.ADD)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); @@ -41,7 +41,7 @@ public class ProposeTest { final JsonRpcResponse response = propose.response(requestWithParams(a0, false)); - assertThat(proposer.get(a0)).isEqualTo(Optional.of(Vote.DROP)); + assertThat(proposer.get(a0)).isEqualTo(Optional.of(VoteType.DROP)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); @@ -56,7 +56,7 @@ public class ProposeTest { proposer.auth(a0); final JsonRpcResponse response = propose.response(requestWithParams(a0, true)); - assertThat(proposer.get(a0)).isEqualTo(Optional.of(Vote.AUTH)); + assertThat(proposer.get(a0)).isEqualTo(Optional.of(VoteType.ADD)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); @@ -71,7 +71,7 @@ public class ProposeTest { proposer.drop(a0); final JsonRpcResponse response = propose.response(requestWithParams(a0, false)); - assertThat(proposer.get(a0)).isEqualTo(Optional.of(Vote.DROP)); + assertThat(proposer.get(a0)).isEqualTo(Optional.of(VoteType.DROP)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); @@ -86,7 +86,7 @@ public class ProposeTest { proposer.drop(a0); final JsonRpcResponse response = propose.response(requestWithParams(a0, true)); - assertThat(proposer.get(a0)).isEqualTo(Optional.of(Vote.AUTH)); + assertThat(proposer.get(a0)).isEqualTo(Optional.of(VoteType.ADD)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); @@ -101,7 +101,7 @@ public class ProposeTest { proposer.auth(a0); final JsonRpcResponse response = propose.response(requestWithParams(a0, false)); - assertThat(proposer.get(a0)).isEqualTo(Optional.of(Vote.DROP)); + assertThat(proposer.get(a0)).isEqualTo(Optional.of(VoteType.DROP)); assertThat(response.getType()).isEqualTo(JsonRpcResponseType.SUCCESS); final JsonRpcSuccessResponse successResponse = (JsonRpcSuccessResponse) response; assertThat(successResponse.getResult()).isEqualTo(true); diff --git a/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/VoteProposer.java b/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/VoteProposer.java index e189ac41a8..bec6a4b478 100644 --- a/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/VoteProposer.java +++ b/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/VoteProposer.java @@ -12,12 +12,8 @@ import java.util.concurrent.atomic.AtomicInteger; /** Container for pending votes and selecting a vote for new blocks */ public class VoteProposer { - public enum Vote { - AUTH, - DROP - } - private final Map proposals = new ConcurrentHashMap<>(); + private final Map proposals = new ConcurrentHashMap<>(); private final AtomicInteger votePosition = new AtomicInteger(0); /** @@ -26,7 +22,7 @@ public class VoteProposer { * @param address The address to be voted in */ public void auth(final Address address) { - proposals.put(address, Vote.AUTH); + proposals.put(address, VoteType.ADD); } /** @@ -35,7 +31,7 @@ public class VoteProposer { * @param address The address to be voted out */ public void drop(final Address address) { - proposals.put(address, Vote.DROP); + proposals.put(address, VoteType.DROP); } /** @@ -52,14 +48,14 @@ public class VoteProposer { proposals.clear(); } - public Optional get(final Address address) { + public Optional get(final Address address) { return Optional.ofNullable(proposals.get(address)); } private boolean voteNotYetCast( final Address localAddress, final Address voteAddress, - final Vote vote, + final VoteType vote, final Collection
validators, final VoteTally tally) { @@ -69,17 +65,17 @@ public class VoteProposer { tally.getOutstandingRemoveVotesFor(voteAddress).contains(localAddress); // if they're a validator, we want to see them dropped, and we haven't voted to drop them yet - if (validators.contains(voteAddress) && !votedDrop && vote == Vote.DROP) { + if (validators.contains(voteAddress) && !votedDrop && vote == VoteType.DROP) { return true; // or if we've previously voted to auth them and we want to drop them - } else if (votedAuth && vote == Vote.DROP) { + } else if (votedAuth && vote == VoteType.DROP) { return true; // if they're not currently a validator and we want to see them authed and we haven't voted to // auth them yet - } else if (!validators.contains(voteAddress) && !votedAuth && vote == Vote.AUTH) { + } else if (!validators.contains(voteAddress) && !votedAuth && vote == VoteType.ADD) { return true; // or if we've previously voted to drop them and we want to see them authed - } else if (votedDrop && vote == Vote.AUTH) { + } else if (votedDrop && vote == VoteType.ADD) { return true; } @@ -94,10 +90,10 @@ public class VoteProposer { * @return Either an address with the vote (auth or drop) or no vote if we have no valid pending * votes */ - public Optional> getVote( + public Optional> getVote( final Address localAddress, final VoteTally tally) { final Collection
validators = tally.getCurrentValidators(); - final List> validVotes = new ArrayList<>(); + final List> validVotes = new ArrayList<>(); proposals .entrySet() diff --git a/consensus/common/src/test/java/net/consensys/pantheon/consensus/common/VoteProposerTest.java b/consensus/common/src/test/java/net/consensys/pantheon/consensus/common/VoteProposerTest.java index d55a88a868..50880dd704 100644 --- a/consensus/common/src/test/java/net/consensys/pantheon/consensus/common/VoteProposerTest.java +++ b/consensus/common/src/test/java/net/consensys/pantheon/consensus/common/VoteProposerTest.java @@ -4,7 +4,6 @@ import static net.consensys.pantheon.consensus.common.VoteType.ADD; import static net.consensys.pantheon.consensus.common.VoteType.DROP; import static org.assertj.core.api.Assertions.assertThat; -import net.consensys.pantheon.consensus.common.VoteProposer.Vote; import net.consensys.pantheon.ethereum.core.Address; import java.util.AbstractMap; @@ -46,9 +45,9 @@ public class VoteProposerTest { assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) .isEqualTo(Optional.empty()); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.singletonList(a1)))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.DROP))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.DROP))); assertThat(proposer.getVote(localAddress, new VoteTally(Arrays.asList(a1, a2, a3)))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.DROP))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.DROP))); assertThat(proposer.getVote(localAddress, new VoteTally(Arrays.asList(a2, a3)))) .isEqualTo(Optional.empty()); } @@ -63,13 +62,13 @@ public class VoteProposerTest { proposer.auth(a1); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.singletonList(a1)))) .isEqualTo(Optional.empty()); assertThat(proposer.getVote(localAddress, new VoteTally(Arrays.asList(a1, a2, a3)))) .isEqualTo(Optional.empty()); assertThat(proposer.getVote(localAddress, new VoteTally(Arrays.asList(a2, a3)))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); } @Test @@ -84,13 +83,13 @@ public class VoteProposerTest { proposer.discard(a2); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.singletonList(a1)))) .isEqualTo(Optional.empty()); assertThat(proposer.getVote(localAddress, new VoteTally(Arrays.asList(a1, a2, a3)))) .isEqualTo(Optional.empty()); assertThat(proposer.getVote(localAddress, new VoteTally(Arrays.asList(a2, a3)))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); } @Test @@ -105,13 +104,13 @@ public class VoteProposerTest { proposer.auth(a3); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a3, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a3, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, VoteType.ADD))); } @Test @@ -128,13 +127,13 @@ public class VoteProposerTest { proposer.drop(a4); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a3, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a3, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); assertThat(proposer.getVote(localAddress, new VoteTally(Collections.emptyList()))) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a2, VoteType.ADD))); } @Test @@ -150,7 +149,7 @@ public class VoteProposerTest { tally.addVote(localAddress, a1, ADD); assertThat(proposer.getVote(localAddress, tally)) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.DROP))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.DROP))); } @Test @@ -166,7 +165,7 @@ public class VoteProposerTest { tally.addVote(localAddress, a1, DROP); assertThat(proposer.getVote(localAddress, tally)) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); } @Test @@ -182,7 +181,7 @@ public class VoteProposerTest { proposer.drop(a1); assertThat(proposer.getVote(localAddress, tally)) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.DROP))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.DROP))); } @Test @@ -198,6 +197,6 @@ public class VoteProposerTest { proposer.auth(a1); assertThat(proposer.getVote(localAddress, tally)) - .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, Vote.AUTH))); + .isEqualTo(Optional.of(new AbstractMap.SimpleEntry<>(a1, VoteType.ADD))); } } diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java index 45ea61d7fd..49073aed40 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java @@ -35,7 +35,6 @@ public class IbftBlockCreator extends AbstractBlockCreator { private static final Logger LOG = LogManager.getLogger(); private final KeyPair nodeKeys; - private final ProtocolSchedule protocolSchedule; public IbftBlockCreator( final Address coinbase, @@ -58,7 +57,6 @@ public class IbftBlockCreator extends AbstractBlockCreator { Util.publicKeyToAddress(nodeKeys.getPublicKey()), parentHeader); this.nodeKeys = nodeKeys; - this.protocolSchedule = protocolSchedule; } /** diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java index c748de91a3..26482baedb 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java @@ -47,11 +47,11 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { private final ExtraDataCalculator extraDataCalculator; private final PendingTransactions pendingTransactions; - private final ProtocolContext protocolContext; - private final ProtocolSchedule protocolSchedule; + protected final ProtocolContext protocolContext; + protected final ProtocolSchedule protocolSchedule; private final Wei minTransactionGasPrice; private final Address miningBeneficiary; - private final BlockHeader parentHeader; + protected final BlockHeader parentHeader; private final AtomicBoolean isCancelled = new AtomicBoolean(false);