|
|
|
@ -28,6 +28,7 @@ import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; |
|
|
|
|
import org.hyperledger.besu.datatypes.Address; |
|
|
|
|
import org.hyperledger.besu.datatypes.Hash; |
|
|
|
|
import org.hyperledger.besu.ethereum.ProtocolContext; |
|
|
|
|
import org.hyperledger.besu.ethereum.chain.BadBlockManager; |
|
|
|
|
import org.hyperledger.besu.ethereum.chain.MutableBlockchain; |
|
|
|
|
import org.hyperledger.besu.ethereum.core.AddressHelpers; |
|
|
|
|
import org.hyperledger.besu.ethereum.core.Block; |
|
|
|
@ -80,7 +81,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.number(1).parentHash(genesisBlock.getHash()); |
|
|
|
|
final Block block_1 = createEmptyBlock(proposerKeyPair); |
|
|
|
@ -104,7 +107,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.number(1).parentHash(genesisBlock.getHash()); |
|
|
|
|
final Block block_1 = createEmptyBlock(proposerKeyPair); |
|
|
|
@ -137,7 +142,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.parentHash(genesisBlock.getHash()).number(1); |
|
|
|
|
final Block block_1 = createEmptyBlock(proposerKeyPair); |
|
|
|
@ -166,7 +173,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.parentHash(genesisBlock.getHash()).number(1); |
|
|
|
|
final Block block_1 = createEmptyBlock(proposerKeyPair); |
|
|
|
@ -210,7 +219,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.parentHash(genesisBlock.getHash()).number(1); |
|
|
|
|
final Block block_1 = createEmptyBlock(otherNodeKeyPair); |
|
|
|
@ -238,7 +249,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.parentHash(Hash.ZERO).number(3); |
|
|
|
|
final BlockHeader parentHeader = |
|
|
|
@ -261,7 +274,9 @@ public class NodeCanProduceNextBlockTest { |
|
|
|
|
final ValidatorProvider validatorProvider = mock(ValidatorProvider.class); |
|
|
|
|
when(validatorProvider.getValidatorsAfterBlock(any())).thenReturn(validatorList); |
|
|
|
|
final CliqueContext cliqueContext = new CliqueContext(validatorProvider, null, blockInterface); |
|
|
|
|
cliqueProtocolContext = new ProtocolContext(blockChain, null, cliqueContext, Optional.empty()); |
|
|
|
|
cliqueProtocolContext = |
|
|
|
|
new ProtocolContext( |
|
|
|
|
blockChain, null, cliqueContext, Optional.empty(), new BadBlockManager()); |
|
|
|
|
|
|
|
|
|
headerBuilder.parentHash(Hash.ZERO).number(3); |
|
|
|
|
final BlockHeader parentHeader = headerBuilder.buildHeader(); |
|
|
|
|