@Override
  public void disableWorldStateTrie() {
    // TODO maybe find a best way in the future to delete and disable trie
    worldStateArchive.ifPresent(
        archive -> {
          archive.getWorldStateSharedSpec().setTrieDisabled(true);
          final PathBasedWorldStateKeyValueStorage worldStateStorage =
              archive.getWorldStateKeyValueStorage();
          final Optional<Hash> worldStateBlockHash = worldStateStorage.getWorldStateBlockHash();
          final Optional<Bytes> worldStateRootHash = worldStateStorage.getWorldStateRootHash();
          if (worldStateRootHash.isPresent() && worldStateBlockHash.isPresent()) {
            worldStateStorage.clearTrie();
            // keep root and block hash in the trie branch
            final PathBasedWorldStateKeyValueStorage.Updater updater = worldStateStorage.updater();
            updater.saveWorldState(
                worldStateBlockHash.get(), Bytes32.wrap(worldStateRootHash.get()), Bytes.EMPTY);
            updater.commit();

            // currently only bonsai needs an explicit upgrade to full flat db
            if (worldStateStorage instanceof BonsaiWorldStateKeyValueStorage bonsaiStorage) {
              bonsaiStorage.upgradeToFullFlatDbMode();
            }
          }
        });
  }
Constructor for SynchronizationServiceImpl.

@param synchronizer synchronizer
@param protocolContext protocol context
@param protocolSchedule protocol schedule
@param syncState sync state
@param worldStateArchive world state archive
app/src/main/java/org/hyperledger/besu/services/SynchronizationServiceImpl.java