@ -42,6 +42,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Util ;
import org.hyperledger.besu.ethereum.core.Util ;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState ;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState ;
import java.util.Collections ;
import java.util.List ;
import java.util.List ;
import java.util.Optional ;
import java.util.Optional ;
@ -119,7 +120,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
final Block importedBlock = createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
blockChain . appendBlock ( importedBlock , List s. emptyList ( ) ) ;
blockChain . appendBlock ( importedBlock , Collection s. emptyList ( ) ) ;
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
// validator, and the created block came from an out-turn validator.
@ -147,7 +148,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock ( 2 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
final Block importedBlock = createEmptyBlock ( 2 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
blockChain . appendBlock ( importedBlock , List s. emptyList ( ) ) ;
blockChain . appendBlock ( importedBlock , Collection s. emptyList ( ) ) ;
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
// validator, and the created block came from an out-turn validator.
@ -159,7 +160,7 @@ public class CliqueMiningCoordinatorTest {
@Test
@Test
public void outOfTurnBlockImportedInterruptsOutOfTurnMiningOperation ( ) {
public void outOfTurnBlockImportedInterruptsOutOfTurnMiningOperation ( ) {
blockChain . appendBlock (
blockChain . appendBlock (
createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , validatorKeys ) , List s. emptyList ( ) ) ;
createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , validatorKeys ) , Collection s. emptyList ( ) ) ;
when ( blockMiner . getParentHeader ( ) ) . thenReturn ( blockChain . getChainHeadHeader ( ) ) ;
when ( blockMiner . getParentHeader ( ) ) . thenReturn ( blockChain . getChainHeadHeader ( ) ) ;
@ -178,7 +179,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock ( 2 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
final Block importedBlock = createEmptyBlock ( 2 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
blockChain . appendBlock ( importedBlock , List s. emptyList ( ) ) ;
blockChain . appendBlock ( importedBlock , Collection s. emptyList ( ) ) ;
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
// validator, and the created block came from an out-turn validator.
@ -190,7 +191,7 @@ public class CliqueMiningCoordinatorTest {
@Test
@Test
public void outOfTurnBlockImportedInterruptsNonRunningMiner ( ) {
public void outOfTurnBlockImportedInterruptsNonRunningMiner ( ) {
blockChain . appendBlock (
blockChain . appendBlock (
createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , proposerKeys ) , List s. emptyList ( ) ) ;
createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , proposerKeys ) , Collection s. emptyList ( ) ) ;
when ( blockMiner . getParentHeader ( ) ) . thenReturn ( blockChain . getChainHeadHeader ( ) ) ;
when ( blockMiner . getParentHeader ( ) ) . thenReturn ( blockChain . getChainHeadHeader ( ) ) ;
@ -209,7 +210,7 @@ public class CliqueMiningCoordinatorTest {
final Block importedBlock = createEmptyBlock ( 2 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
final Block importedBlock = createEmptyBlock ( 2 , blockChain . getChainHeadHash ( ) , validatorKeys ) ;
blockChain . appendBlock ( importedBlock , List s. emptyList ( ) ) ;
blockChain . appendBlock ( importedBlock , Collection s. emptyList ( ) ) ;
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
// validator, and the created block came from an out-turn validator.
@ -234,7 +235,7 @@ public class CliqueMiningCoordinatorTest {
when ( minerExecutor . startAsyncMining ( any ( ) , any ( ) , any ( ) ) ) . thenReturn ( Optional . of ( blockMiner ) ) ;
when ( minerExecutor . startAsyncMining ( any ( ) , any ( ) , any ( ) ) ) . thenReturn ( Optional . of ( blockMiner ) ) ;
final Block importedBlock = createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , proposerKeys ) ;
final Block importedBlock = createEmptyBlock ( 1 , blockChain . getChainHeadHash ( ) , proposerKeys ) ;
blockChain . appendBlock ( importedBlock , List s. emptyList ( ) ) ;
blockChain . appendBlock ( importedBlock , Collection s. emptyList ( ) ) ;
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// The minerExecutor should not be invoked as the mining operation was conducted by an in-turn
// validator, and the created block came from an out-turn validator.
// validator, and the created block came from an out-turn validator.
@ -248,6 +249,6 @@ public class CliqueMiningCoordinatorTest {
headerTestFixture . number ( blockNumber ) . parentHash ( parentHash ) ;
headerTestFixture . number ( blockNumber ) . parentHash ( parentHash ) ;
final BlockHeader header =
final BlockHeader header =
TestHelpers . createCliqueSignedBlockHeader ( headerTestFixture , signer , validators ) ;
TestHelpers . createCliqueSignedBlockHeader ( headerTestFixture , signer , validators ) ;
return new Block ( header , new BlockBody ( List s. emptyList ( ) , List s. emptyList ( ) ) ) ;
return new Block ( header , new BlockBody ( Collection s. emptyList ( ) , Collection s. emptyList ( ) ) ) ;
}
}
}
}