Skip to content

Commit

Permalink
Merge pull request #6740 from HenrikJannsen/rename_bm_accounting_store
Browse files Browse the repository at this point in the history
Use new burningman accounting file recreated from scratch.
  • Loading branch information
alejandrogarcia83 authored Jun 28, 2023
2 parents edfa035 + e54ed37 commit 8c70dd6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@
import bisq.network.p2p.storage.persistence.ResourceDataStoreService;
import bisq.network.p2p.storage.persistence.StoreService;

import bisq.common.UserThread;
import bisq.common.config.Config;
import bisq.common.file.FileUtil;
import bisq.common.persistence.PersistenceManager;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import java.nio.file.Path;

import java.io.File;
import java.io.IOException;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -43,7 +48,7 @@
@Slf4j
@Singleton
public class BurningManAccountingStoreService extends StoreService<BurningManAccountingStore> {
private static final String FILE_NAME = "BurningManAccountingStore";
private static final String FILE_NAME = "BurningManAccountingStore_v2";

@Inject
public BurningManAccountingStoreService(ResourceDataStoreService resourceDataStoreService,
Expand All @@ -54,6 +59,19 @@ public BurningManAccountingStoreService(ResourceDataStoreService resourceDataSto
resourceDataStoreService.addService(this);
}

protected void readFromResources(String postFix, Runnable completeHandler) {
super.readFromResources(postFix, completeHandler);

UserThread.runAfter(() -> {
try {
// Delete old BurningManAccountingStore file which was missing some data.
FileUtil.deleteFileIfExists(Path.of(absolutePathOfStorageDir, "BurningManAccountingStore").toFile());
} catch (IOException e) {
throw new RuntimeException(e);
}
}, 5);
}


///////////////////////////////////////////////////////////////////////////////////////////
// API
Expand Down Expand Up @@ -100,7 +118,7 @@ protected BurningManAccountingStore createStore() {

@Override
protected void initializePersistenceManager() {
persistenceManager.initialize(store, PersistenceManager.Source.NETWORK);
persistenceManager.initialize(store, FILE_NAME, PersistenceManager.Source.NETWORK);
}

@Override
Expand Down
Binary file not shown.

0 comments on commit 8c70dd6

Please sign in to comment.