mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-23 15:10:41 -04:00
install monero bins to local app directories and exclude from backup
This commit is contained in:
parent
748f698314
commit
8cdd65e7dd
5 changed files with 27 additions and 12 deletions
|
@ -27,11 +27,13 @@ import haveno.common.crypto.KeyStorage;
|
|||
import haveno.common.file.FileUtil;
|
||||
import haveno.common.persistence.PersistenceManager;
|
||||
import haveno.common.util.ZipUtils;
|
||||
import haveno.core.xmr.wallet.XmrWalletService;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import lombok.Getter;
|
||||
|
@ -139,6 +141,7 @@ public class CoreAccountService {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: share common code with BackupView to backup
|
||||
public void backupAccount(int bufferSize, Consumer<InputStream> consume, Consumer<Exception> error) {
|
||||
if (!accountExists()) throw new IllegalStateException("Cannot backup non existing account");
|
||||
|
||||
|
@ -149,9 +152,16 @@ public class CoreAccountService {
|
|||
PipedInputStream in = new PipedInputStream(bufferSize); // pipe the serialized account object to stream which will be read by the consumer
|
||||
PipedOutputStream out = new PipedOutputStream(in);
|
||||
log.info("Zipping directory " + dataDir);
|
||||
|
||||
// exclude monero binaries from backup so they're reinstalled with permissions
|
||||
List<File> excludedFiles = Arrays.asList(
|
||||
new File(XmrWalletService.MONERO_WALLET_RPC_PATH),
|
||||
new File(XmrLocalNode.MONEROD_PATH)
|
||||
);
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
ZipUtils.zipDirToStream(dataDir, out, bufferSize);
|
||||
ZipUtils.zipDirToStream(dataDir, out, bufferSize, excludedFiles);
|
||||
} catch (Exception ex) {
|
||||
error.accept(ex);
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ public final class XmrConnectionService {
|
|||
}
|
||||
|
||||
private void onConnectionChanged(MoneroRpcConnection currentConnection) {
|
||||
if (isShutDownStarted) return;
|
||||
if (isShutDownStarted || !accountService.isAccountOpen()) return;
|
||||
if (currentConnection == null) {
|
||||
log.warn("Setting daemon connection to null");
|
||||
Thread.dumpStack();
|
||||
|
|
|
@ -113,7 +113,7 @@ public class XmrWalletService {
|
|||
|
||||
// monero configuration
|
||||
public static final int NUM_BLOCKS_UNLOCK = 10;
|
||||
public static final String MONERO_BINS_DIR = Config.baseCurrencyNetwork().isTestnet() ? System.getProperty("user.dir") + File.separator + ".localnet" : Config.appDataDir().getAbsolutePath(); // .localnet contains monero binaries and wallet files
|
||||
public static final String MONERO_BINS_DIR = Config.appDataDir().getAbsolutePath();
|
||||
public static final String MONERO_WALLET_RPC_NAME = Utilities.isWindows() ? "monero-wallet-rpc.exe" : "monero-wallet-rpc";
|
||||
public static final String MONERO_WALLET_RPC_PATH = MONERO_BINS_DIR + File.separator + MONERO_WALLET_RPC_NAME;
|
||||
public static final double MINER_FEE_TOLERANCE = 0.25; // miner fee must be within percent of estimated fee
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue