mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Cleanup
This commit is contained in:
parent
c288c107af
commit
4c488fd574
@ -60,15 +60,17 @@ public class WalletConfig extends AbstractIdleService {
|
||||
private final String btcWalletFilePrefix;
|
||||
private final String squWalletFilePrefix;
|
||||
private volatile Wallet vBtcWallet;
|
||||
private volatile Wallet vTokenWallet;
|
||||
private volatile Wallet vSquWallet;
|
||||
private volatile File vBtcWalletFile;
|
||||
private volatile File vSquWalletFile;
|
||||
@Nullable
|
||||
private DeterministicSeed btcSeed;
|
||||
@Nullable
|
||||
private DeterministicSeed squSeed;
|
||||
private int btcWalletLookaheadSize = -1;
|
||||
private int squWalletLookaheadSize = -1;
|
||||
|
||||
final NetworkParameters params;
|
||||
private final NetworkParameters params;
|
||||
private volatile BlockChain vChain;
|
||||
private volatile BlockStore vStore;
|
||||
private volatile PeerGroup vPeerGroup;
|
||||
@ -79,20 +81,15 @@ public class WalletConfig extends AbstractIdleService {
|
||||
private boolean autoStop = true;
|
||||
private InputStream checkpoints;
|
||||
private boolean blockingStartup = true;
|
||||
private boolean useTor = false; // Perhaps in future we can change this to true.
|
||||
private boolean useTor = false;
|
||||
private String userAgent;
|
||||
private String version;
|
||||
private WalletProtobufSerializer.WalletFactory walletFactory;
|
||||
|
||||
@Nullable
|
||||
private PeerDiscovery discovery;
|
||||
|
||||
private final Context context;
|
||||
private long bloomFilterTweak = 0;
|
||||
private double bloomFilterFPRate = -1;
|
||||
private int btcWalletLookaheadSize = -1;
|
||||
private int squWalletLookaheadSize = -1;
|
||||
|
||||
private Socks5Proxy socks5Proxy;
|
||||
|
||||
/**
|
||||
@ -376,7 +373,7 @@ public class WalletConfig extends AbstractIdleService {
|
||||
keyChainGroup = new BitsquareKeyChainGroup(params, new SquDeterministicKeyChain(squSeed), false, squWalletLookaheadSize);
|
||||
else
|
||||
keyChainGroup = new BitsquareKeyChainGroup(params, false, squWalletLookaheadSize);
|
||||
vTokenWallet = createOrLoadWallet(vSquWalletFile, shouldReplaySquWallet, null, squSeed, keyChainGroup);
|
||||
vSquWallet = createOrLoadWallet(vSquWalletFile, shouldReplaySquWallet, null, squSeed, keyChainGroup);
|
||||
|
||||
// Initiate Bitcoin network objects (block store, blockchain and peer group)
|
||||
vStore = provideBlockStore(chainFile);
|
||||
@ -434,9 +431,9 @@ public class WalletConfig extends AbstractIdleService {
|
||||
vPeerGroup.addPeerDiscovery(discovery != null ? discovery : new DnsDiscovery(params));
|
||||
}
|
||||
vChain.addWallet(vBtcWallet);
|
||||
vChain.addWallet(vTokenWallet);
|
||||
vChain.addWallet(vSquWallet);
|
||||
vPeerGroup.addWallet(vBtcWallet);
|
||||
vPeerGroup.addWallet(vTokenWallet);
|
||||
vPeerGroup.addWallet(vSquWallet);
|
||||
onSetupCompleted();
|
||||
|
||||
if (blockingStartup) {
|
||||
@ -566,12 +563,12 @@ public class WalletConfig extends AbstractIdleService {
|
||||
Context.propagate(context);
|
||||
vPeerGroup.stop();
|
||||
vBtcWallet.saveToFile(vBtcWalletFile);
|
||||
vTokenWallet.saveToFile(vSquWalletFile);
|
||||
vSquWallet.saveToFile(vSquWalletFile);
|
||||
vStore.close();
|
||||
|
||||
vPeerGroup = null;
|
||||
vBtcWallet = null;
|
||||
vTokenWallet = null;
|
||||
vSquWallet = null;
|
||||
vStore = null;
|
||||
vChain = null;
|
||||
} catch (BlockStoreException e) {
|
||||
@ -600,7 +597,7 @@ public class WalletConfig extends AbstractIdleService {
|
||||
|
||||
public Wallet tokenWallet() {
|
||||
checkState(state() == State.STARTING || state() == State.RUNNING, "Cannot call until startup is complete");
|
||||
return vTokenWallet;
|
||||
return vSquWallet;
|
||||
}
|
||||
|
||||
public PeerGroup peerGroup() {
|
||||
|
@ -63,15 +63,14 @@ public abstract class WalletService {
|
||||
private final CopyOnWriteArraySet<TxConfidenceListener> txConfidenceListeners = new CopyOnWriteArraySet<>();
|
||||
private final CopyOnWriteArraySet<BalanceListener> balanceListeners = new CopyOnWriteArraySet<>();
|
||||
|
||||
final WalletEventListener walletEventListener = new BitsquareWalletEventListener();
|
||||
final NetworkParameters params;
|
||||
|
||||
final WalletsSetup walletsSetup;
|
||||
protected final WalletsSetup walletsSetup;
|
||||
private final Preferences preferences;
|
||||
private final FeeService feeService;
|
||||
|
||||
Wallet wallet;
|
||||
KeyParameter aesKey;
|
||||
protected final WalletEventListener walletEventListener = new BitsquareWalletEventListener();
|
||||
protected final NetworkParameters params;
|
||||
protected Wallet wallet;
|
||||
protected KeyParameter aesKey;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
@ -33,6 +33,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class WalletsManager {
|
||||
private static final Logger log = LoggerFactory.getLogger(WalletsManager.class);
|
||||
|
||||
private final BtcWalletService btcWalletService;
|
||||
private final TradeWalletService tradeWalletService;
|
||||
private final SquWalletService squWalletService;
|
||||
|
Loading…
Reference in New Issue
Block a user