From d87650b944631cd645c2663edb7c00a9e145d842 Mon Sep 17 00:00:00 2001 From: garyschulte Date: Fri, 23 Aug 2024 16:35:18 -0700 Subject: [PATCH] Fleet-mode safe behavior for fcU in SynchronizationService (#7517) * fleet-mode safe behavior for fcU in SynchronizationService Signed-off-by: garyschulte * spotless Signed-off-by: garyschulte --------- Signed-off-by: garyschulte --- .../services/SynchronizationServiceImpl.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/services/SynchronizationServiceImpl.java b/besu/src/main/java/org/hyperledger/besu/services/SynchronizationServiceImpl.java index 898ede5d0d..2e15e2ab82 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/SynchronizationServiceImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/SynchronizationServiceImpl.java @@ -74,17 +74,11 @@ public class SynchronizationServiceImpl implements SynchronizationService { @Override public void fireNewUnverifiedForkchoiceEvent( final Hash head, final Hash safeBlock, final Hash finalizedBlock) { - final MergeContext mergeContext = protocolContext.getConsensusContext(MergeContext.class); - if (mergeContext != null) { - mergeContext.fireNewUnverifiedForkchoiceEvent(head, safeBlock, finalizedBlock); - protocolContext.getBlockchain().setFinalized(finalizedBlock); - protocolContext.getBlockchain().setSafeBlock(safeBlock); - } else { - LOG.atWarn() - .setMessage( - "The merge context is unavailable, hence the fork choice event cannot be triggered") - .log(); - } + protocolContext + .safeConsensusContext(MergeContext.class) + .ifPresent(mc -> mc.fireNewUnverifiedForkchoiceEvent(head, safeBlock, finalizedBlock)); + protocolContext.getBlockchain().setFinalized(finalizedBlock); + protocolContext.getBlockchain().setSafeBlock(safeBlock); } @Override