always use db format for sparrow exporter

This commit is contained in:
Craig Raw 2022-11-08 15:50:27 +02:00
parent a25b53bd44
commit 6990b398c2

View file

@ -31,10 +31,10 @@ public class Sparrow implements WalletImport, WalletExport {
public void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException { public void exportWallet(Wallet wallet, OutputStream outputStream) throws ExportException {
try { try {
Wallet exportedWallet = !wallet.isMasterWallet() ? wallet.getMasterWallet() : wallet; Wallet exportedWallet = !wallet.isMasterWallet() ? wallet.getMasterWallet() : wallet;
PersistenceType persistenceType = exportedWallet.getChildWallets().isEmpty() ? PersistenceType.JSON : PersistenceType.DB; PersistenceType persistenceType = PersistenceType.DB;
Persistence persistence = persistenceType.getInstance(); Persistence persistence = persistenceType.getInstance();
Storage storage = AppServices.get().getOpenWallets().get(exportedWallet); Storage storage = AppServices.get().getOpenWallets().get(exportedWallet);
File tempFile = File.createTempFile(exportedWallet.getName(), "." + persistenceType.getExtension()); File tempFile = File.createTempFile(exportedWallet.getName() + "tmp", "." + persistenceType.getExtension());
tempFile.delete(); tempFile.delete();
Storage tempStorage = new Storage(persistence, tempFile); Storage tempStorage = new Storage(persistence, tempFile);
tempStorage.setKeyDeriver(storage.getKeyDeriver()); tempStorage.setKeyDeriver(storage.getKeyDeriver());