From 11839d24c00a99ce0406b1d86e7de24ad01cf8fe Mon Sep 17 00:00:00 2001 From: Justin Florentine Date: Wed, 27 Sep 2023 17:39:19 -0400 Subject: [PATCH] new order requires more mocking Signed-off-by: Justin Florentine --- .../engine/AbstractEngineForkchoiceUpdatedTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineForkchoiceUpdatedTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineForkchoiceUpdatedTest.java index daad391cbb0..249a12d9f0b 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineForkchoiceUpdatedTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineForkchoiceUpdatedTest.java @@ -141,18 +141,21 @@ public void shouldReturnSyncingIfMissingNewHead() { @Test public void shouldReturnInvalidWithLatestValidHashOnBadBlock() { + BlockHeader mockParent = blockHeaderBuilder.buildHeader(); + blockHeaderBuilder.parentHash(mockParent.getHash()); BlockHeader mockHeader = blockHeaderBuilder.buildHeader(); Hash latestValidHash = Hash.hash(Bytes32.fromHexStringLenient("0xcafebabe")); when(blockchain.getBlockHeader(mockHeader.getHash())).thenReturn(Optional.of(mockHeader)); - when(blockchain.getBlockHeader(mockHeader.getParentHash())).thenReturn(Optional.of(mockHeader)); + when(blockchain.getBlockHeader(mockHeader.getParentHash())).thenReturn(Optional.of(mockParent)); when(mergeCoordinator.getOrSyncHeadByHash(any(), any())).thenReturn(Optional.of(mockHeader)); when(mergeCoordinator.isBadBlock(mockHeader.getHash())).thenReturn(true); + when(mergeCoordinator.isDescendantOf(any(), any())).thenReturn(true); when(mergeCoordinator.getLatestValidHashOfBadBlock(mockHeader.getHash())) .thenReturn(Optional.of(latestValidHash)); assertSuccessWithPayloadForForkchoiceResult( new EngineForkchoiceUpdatedParameter( - mockHeader.getHash(), Hash.ZERO, mockHeader.getParentHash()), + mockHeader.getHash(), mockHeader.getParentHash(), mockHeader.getParentHash()), Optional.empty(), mock(ForkchoiceResult.class), INVALID,