mirror of https://github.com/hyperledger/besu
Removing dead code from the consensus package (#554)
* Removing code identified by the 'unused declaration' analysis in IntelliJ * Undoing removal of injectNewRound as that's actually used * Removing wrapper class from Clique UT * Spotless * Adding back code Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>pull/2/head
parent
fea9168ef4
commit
9cfa01b516
@ -1,18 +0,0 @@ |
||||
/* |
||||
* Copyright 2018 ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
*/ |
||||
package tech.pegasys.pantheon.consensus.clique.headervalidationrules; |
||||
|
||||
public class SignerRateLimitValidationRuleTest { |
||||
|
||||
// Implicitly conducted by NodeCanProduceNextBlockTest.
|
||||
} |
@ -1,51 +0,0 @@ |
||||
/* |
||||
* Copyright 2018 ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
*/ |
||||
package tech.pegasys.pantheon.consensus.ibft; |
||||
|
||||
import tech.pegasys.pantheon.consensus.ibft.messagedata.CommitMessageData; |
||||
import tech.pegasys.pantheon.consensus.ibft.messagedata.IbftV2; |
||||
import tech.pegasys.pantheon.consensus.ibft.messagedata.NewRoundMessageData; |
||||
import tech.pegasys.pantheon.consensus.ibft.messagedata.PrepareMessageData; |
||||
import tech.pegasys.pantheon.consensus.ibft.messagedata.ProposalMessageData; |
||||
import tech.pegasys.pantheon.consensus.ibft.messagedata.RoundChangeMessageData; |
||||
import tech.pegasys.pantheon.consensus.ibft.payload.SignedData; |
||||
import tech.pegasys.pantheon.ethereum.p2p.api.Message; |
||||
import tech.pegasys.pantheon.ethereum.p2p.api.MessageData; |
||||
|
||||
public class IbftMessages { |
||||
|
||||
public static SignedData<?> fromMessage(final Message message) { |
||||
final MessageData messageData = message.getData(); |
||||
|
||||
switch (messageData.getCode()) { |
||||
case IbftV2.PROPOSAL: |
||||
return ProposalMessageData.fromMessageData(messageData).decode(); |
||||
|
||||
case IbftV2.PREPARE: |
||||
return PrepareMessageData.fromMessageData(messageData).decode(); |
||||
|
||||
case IbftV2.COMMIT: |
||||
return CommitMessageData.fromMessageData(messageData).decode(); |
||||
|
||||
case IbftV2.ROUND_CHANGE: |
||||
return RoundChangeMessageData.fromMessageData(messageData).decode(); |
||||
|
||||
case IbftV2.NEW_ROUND: |
||||
return NewRoundMessageData.fromMessageData(messageData).decode(); |
||||
|
||||
default: |
||||
throw new IllegalArgumentException( |
||||
"Received message does not conform to any recognised IBFT message structure."); |
||||
} |
||||
} |
||||
} |
@ -1,37 +0,0 @@ |
||||
/* |
||||
* Copyright 2018 ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
*/ |
||||
package tech.pegasys.pantheon.consensus.ibft.blockcreation; |
||||
|
||||
import tech.pegasys.pantheon.consensus.ibft.IbftContext; |
||||
import tech.pegasys.pantheon.ethereum.ProtocolContext; |
||||
import tech.pegasys.pantheon.ethereum.blockcreation.AbstractBlockScheduler; |
||||
import tech.pegasys.pantheon.ethereum.blockcreation.BlockMiner; |
||||
import tech.pegasys.pantheon.ethereum.chain.MinedBlockObserver; |
||||
import tech.pegasys.pantheon.ethereum.core.BlockHeader; |
||||
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; |
||||
import tech.pegasys.pantheon.util.Subscribers; |
||||
|
||||
public class IbftBlockMiner extends BlockMiner<IbftContext, IbftBlockCreator> { |
||||
|
||||
// TODO(tmm): Currently a place holder to allow infrastructure code to continue to operate
|
||||
// with the advent of multiple consensus methods.
|
||||
public IbftBlockMiner( |
||||
final IbftBlockCreator blockCreator, |
||||
final ProtocolSchedule<IbftContext> protocolSchedule, |
||||
final ProtocolContext<IbftContext> protocolContext, |
||||
final Subscribers<MinedBlockObserver> observers, |
||||
final AbstractBlockScheduler scheduler, |
||||
final BlockHeader parentHeader) { |
||||
super(blockCreator, protocolSchedule, protocolContext, observers, scheduler, parentHeader); |
||||
} |
||||
} |
@ -1,42 +0,0 @@ |
||||
/* |
||||
* Copyright 2018 ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
*/ |
||||
package tech.pegasys.pantheon.consensus.ibftlegacy.blockcreation; |
||||
|
||||
import tech.pegasys.pantheon.consensus.common.ValidatorProvider; |
||||
import tech.pegasys.pantheon.consensus.ibftlegacy.IbftExtraData; |
||||
import tech.pegasys.pantheon.ethereum.blockcreation.AbstractBlockCreator.ExtraDataCalculator; |
||||
import tech.pegasys.pantheon.ethereum.core.BlockHeader; |
||||
import tech.pegasys.pantheon.util.bytes.BytesValue; |
||||
|
||||
import com.google.common.collect.Lists; |
||||
|
||||
public class IbftExtraDataCalculator implements ExtraDataCalculator { |
||||
|
||||
private final ValidatorProvider validatorProvider; |
||||
|
||||
public IbftExtraDataCalculator(final ValidatorProvider validatorProvider) { |
||||
this.validatorProvider = validatorProvider; |
||||
} |
||||
|
||||
@Override |
||||
public BytesValue get(final BlockHeader parent) { |
||||
final BytesValue vanityData = BytesValue.wrap(new byte[32]); |
||||
final IbftExtraData baseExtraData = |
||||
new IbftExtraData( |
||||
vanityData, |
||||
Lists.newArrayList(), |
||||
null, |
||||
Lists.newArrayList(validatorProvider.getValidators())); |
||||
return baseExtraData.encode(); |
||||
} |
||||
} |
Loading…
Reference in new issue