Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new burningman accounting file recreated from scratch. #6740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.