|
18 | 18 | import static java.util.concurrent.TimeUnit.MINUTES;
|
19 | 19 | import static org.assertj.core.api.Assertions.assertThat;
|
20 | 20 | import static org.assertj.core.util.Lists.list;
|
| 21 | +import static org.mockito.Mockito.lenient; |
21 | 22 | import static org.mockito.Mockito.mock;
|
22 | 23 |
|
23 | 24 | import org.hyperledger.besu.config.StubGenesisConfigOptions;
|
| 25 | +import org.hyperledger.besu.datatypes.Hash; |
24 | 26 | import org.hyperledger.besu.ethereum.ProtocolContext;
|
25 | 27 | import org.hyperledger.besu.ethereum.api.ApiConfiguration;
|
26 | 28 | import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
|
|
37 | 39 | import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
|
38 | 40 | import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator;
|
39 | 41 | import org.hyperledger.besu.ethereum.chain.BadBlockManager;
|
| 42 | +import org.hyperledger.besu.ethereum.chain.Blockchain; |
| 43 | +import org.hyperledger.besu.ethereum.core.Block; |
40 | 44 | import org.hyperledger.besu.ethereum.core.MiningConfiguration;
|
41 | 45 | import org.hyperledger.besu.ethereum.core.Synchronizer;
|
42 | 46 | import org.hyperledger.besu.ethereum.eth.EthProtocol;
|
@@ -131,6 +135,13 @@ public static void initServerAndClient() throws Exception {
|
131 | 135 | final StubGenesisConfigOptions genesisConfigOptions =
|
132 | 136 | new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID);
|
133 | 137 |
|
| 138 | + // mocks so that genesis hash is populated |
| 139 | + Blockchain blockchain = mock(Blockchain.class); |
| 140 | + Block block = mock(Block.class); |
| 141 | + lenient().when(blockchainQueries.getBlockchain()).thenReturn(blockchain); |
| 142 | + lenient().when(blockchain.getGenesisBlock()).thenReturn(block); |
| 143 | + lenient().when(block.getHash()).thenReturn(Hash.EMPTY); |
| 144 | + |
134 | 145 | rpcMethods =
|
135 | 146 | new JsonRpcMethodsFactory()
|
136 | 147 | .methods(
|
|
0 commit comments