Check status of block propagation manager before starting or stopping (#4122)

* check status of block propagation manager before starting or stopping

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
pull/4133/head
Daniel Lehrner 2 years ago committed by GitHub
parent e48b73bb70
commit ac3e075ab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 14
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/DefaultSynchronizer.java

@ -14,7 +14,8 @@
- Fixed a trie log layer issue on bonsai during reorg [#4069](https://github.com/hyperledger/besu/pull/4069) - 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) - 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) - 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 ## 22.7.0-RC1

@ -179,7 +179,12 @@ public class DefaultSynchronizer implements Synchronizer {
public CompletableFuture<Void> start() { public CompletableFuture<Void> start() {
if (running.compareAndSet(false, true)) { if (running.compareAndSet(false, true)) {
LOG.info("Starting synchronizer."); LOG.info("Starting synchronizer.");
blockPropagationManager.ifPresent(BlockPropagationManager::start); blockPropagationManager.ifPresent(
manager -> {
if (!manager.isRunning()) {
manager.start();
}
});
CompletableFuture<Void> future; CompletableFuture<Void> future;
if (fastSyncDownloader.isPresent()) { if (fastSyncDownloader.isPresent()) {
future = fastSyncDownloader.get().start().thenCompose(this::handleSyncResult); future = fastSyncDownloader.get().start().thenCompose(this::handleSyncResult);
@ -201,7 +206,12 @@ public class DefaultSynchronizer implements Synchronizer {
fastSyncDownloader.ifPresent(FastSyncDownloader::stop); fastSyncDownloader.ifPresent(FastSyncDownloader::stop);
fullSyncDownloader.ifPresent(FullSyncDownloader::stop); fullSyncDownloader.ifPresent(FullSyncDownloader::stop);
maybePruner.ifPresent(Pruner::stop); maybePruner.ifPresent(Pruner::stop);
blockPropagationManager.ifPresent(BlockPropagationManager::stop); blockPropagationManager.ifPresent(
manager -> {
if (manager.isRunning()) {
manager.stop();
}
});
} }
} }

Loading…
Cancel
Save