diff --git a/CHANGELOG.md b/CHANGELOG.md index bcc4dd8ba0..9d6ca2eb35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ - Fixed a trie log layer issue on bonsai during reorg [#4069](https://github.com/hyperledger/besu/pull/4069) - Fix transition protocol schedule to return the pre Merge schedule when reorg pre TTD [#4078](https://github.com/hyperledger/besu/pull/4078) - Remove hash to sync from the queue only if the sync step succeeds [#4105](https://github.com/hyperledger/besu/pull/4105) -- The build process runs successfully even though the system language is not English [#4102](https://github.com/hyperledger/besu/pull/4102) +- The build process runs successfully even though the system language is not English [#4102](https://github.com/hyperledger/besu/pull/4102) +- Avoid starting or stopping the BlockPropagationManager more than once [#4122](https://github.com/hyperledger/besu/pull/4122) ## 22.7.0-RC1 diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/DefaultSynchronizer.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/DefaultSynchronizer.java index 23241cf3e1..34d31764bc 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/DefaultSynchronizer.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/DefaultSynchronizer.java @@ -179,7 +179,12 @@ public class DefaultSynchronizer implements Synchronizer { public CompletableFuture start() { if (running.compareAndSet(false, true)) { LOG.info("Starting synchronizer."); - blockPropagationManager.ifPresent(BlockPropagationManager::start); + blockPropagationManager.ifPresent( + manager -> { + if (!manager.isRunning()) { + manager.start(); + } + }); CompletableFuture future; if (fastSyncDownloader.isPresent()) { future = fastSyncDownloader.get().start().thenCompose(this::handleSyncResult); @@ -201,7 +206,12 @@ public class DefaultSynchronizer implements Synchronizer { fastSyncDownloader.ifPresent(FastSyncDownloader::stop); fullSyncDownloader.ifPresent(FullSyncDownloader::stop); maybePruner.ifPresent(Pruner::stop); - blockPropagationManager.ifPresent(BlockPropagationManager::stop); + blockPropagationManager.ifPresent( + manager -> { + if (manager.isRunning()) { + manager.stop(); + } + }); } }