Skip to content

Commit

Permalink
Merge pull request #4930 from chimp1984/use-historical-data-store-for…
Browse files Browse the repository at this point in the history
…-account-age

Use HistoricalDataStoreService for AccountAgeWitnessStorageService
  • Loading branch information
ripcurlx authored Dec 14, 2020
2 parents b8cec17 + 9ba184e commit 810c0da
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

package bisq.core.account.witness;

import bisq.network.p2p.storage.P2PDataStorage;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
import bisq.network.p2p.storage.persistence.MapStoreService;
import bisq.network.p2p.storage.persistence.HistoricalDataStoreService;

import bisq.common.config.Config;
import bisq.common.persistence.PersistenceManager;
Expand All @@ -29,12 +28,10 @@

import java.io.File;

import java.util.Map;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class AccountAgeWitnessStorageService extends MapStoreService<AccountAgeWitnessStore, PersistableNetworkPayload> {
public class AccountAgeWitnessStorageService extends HistoricalDataStoreService<AccountAgeWitnessStore> {
private static final String FILE_NAME = "AccountAgeWitnessStore";


Expand All @@ -48,23 +45,19 @@ public AccountAgeWitnessStorageService(@Named(Config.STORAGE_DIR) File storageDi
super(storageDir, persistenceManager);
}


///////////////////////////////////////////////////////////////////////////////////////////
// API
///////////////////////////////////////////////////////////////////////////////////////////

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

@Override
public String getFileName() {
return FILE_NAME;
}

@Override
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap() {
return store.getMap();
protected void initializePersistenceManager() {
persistenceManager.initialize(store, PersistenceManager.Source.NETWORK);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion desktop/package/macosx/copy_dbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ resDir=p2p/src/main/resources
# Only commit new TradeStatistics3Store if you plan to add it to
# https://github.com/bisq-network/bisq/blob/0345c795e2c227d827a1f239a323dda1250f4e69/common/src/main/java/bisq/common/app/Version.java#L40 as well.
cp "$dbDir/TradeStatistics3Store" "$resDir/TradeStatistics3Store_${version}_BTC_MAINNET"
cp "$dbDir/AccountAgeWitnessStore" "$resDir/AccountAgeWitnessStore_BTC_MAINNET"
cp "$dbDir/AccountAgeWitnessStore" "$resDir/AccountAgeWitnessStore_${version}_BTC_MAINNET"
cp "$dbDir/DaoStateStore" "$resDir/DaoStateStore_BTC_MAINNET"
cp "$dbDir/SignedWitnessStore" "$resDir/SignedWitnessStore_BTC_MAINNET"
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,7 @@ private void readHistoricalStoreFromResources(String version,
pruneStore(persisted, version);
completeHandler.run();
},
() -> {
log.warn("Resource file with file name {} does not exits.", fileName);
completeHandler.run();
});
completeHandler::run);
}

private void pruneStore(PersistableNetworkPayloadStore<? extends PersistableNetworkPayload> historicalStore,
Expand Down

0 comments on commit 810c0da

Please sign in to comment.