mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 01:56:44 +00:00
add walletconfig
This commit is contained in:
parent
7c34ec7c3b
commit
fa18ec9d45
2 changed files with 63 additions and 0 deletions
|
@ -38,6 +38,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
private final TreeSet<WalletNode> purposeNodes = new TreeSet<>();
|
private final TreeSet<WalletNode> purposeNodes = new TreeSet<>();
|
||||||
private final Map<Sha256Hash, BlockTransaction> transactions = new HashMap<>();
|
private final Map<Sha256Hash, BlockTransaction> transactions = new HashMap<>();
|
||||||
private final Map<String, String> detachedLabels = new HashMap<>();
|
private final Map<String, String> detachedLabels = new HashMap<>();
|
||||||
|
private WalletConfig walletConfig;
|
||||||
private MixConfig mixConfig;
|
private MixConfig mixConfig;
|
||||||
private final Map<Sha256Hash, UtxoMixData> utxoMixes = new HashMap<>();
|
private final Map<Sha256Hash, UtxoMixData> utxoMixes = new HashMap<>();
|
||||||
private Integer storedBlockHeight;
|
private Integer storedBlockHeight;
|
||||||
|
@ -441,6 +442,26 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
return detachedLabels;
|
return detachedLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WalletConfig getWalletConfig() {
|
||||||
|
return walletConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WalletConfig getMasterWalletConfig() {
|
||||||
|
if(!isMasterWallet()) {
|
||||||
|
return getMasterWallet().getMasterWalletConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(walletConfig == null) {
|
||||||
|
walletConfig = new WalletConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
return walletConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWalletConfig(WalletConfig walletConfig) {
|
||||||
|
this.walletConfig = walletConfig;
|
||||||
|
}
|
||||||
|
|
||||||
public MixConfig getMixConfig() {
|
public MixConfig getMixConfig() {
|
||||||
return mixConfig;
|
return mixConfig;
|
||||||
}
|
}
|
||||||
|
@ -1805,6 +1826,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
for(String entry : detachedLabels.keySet()) {
|
for(String entry : detachedLabels.keySet()) {
|
||||||
copy.detachedLabels.put(entry, detachedLabels.get(entry));
|
copy.detachedLabels.put(entry, detachedLabels.get(entry));
|
||||||
}
|
}
|
||||||
|
copy.setWalletConfig(walletConfig == null ? null : walletConfig.copy());
|
||||||
copy.setMixConfig(mixConfig == null ? null : mixConfig.copy());
|
copy.setMixConfig(mixConfig == null ? null : mixConfig.copy());
|
||||||
for(Sha256Hash hash : utxoMixes.keySet()) {
|
for(Sha256Hash hash : utxoMixes.keySet()) {
|
||||||
copy.utxoMixes.put(hash, utxoMixes.get(hash));
|
copy.utxoMixes.put(hash, utxoMixes.get(hash));
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.sparrowwallet.drongo.wallet;
|
||||||
|
|
||||||
|
public class WalletConfig extends Persistable {
|
||||||
|
private byte[] iconData;
|
||||||
|
private boolean userIcon;
|
||||||
|
private boolean usePayNym;
|
||||||
|
|
||||||
|
public WalletConfig() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public WalletConfig(byte[] iconData, boolean userIcon, boolean usePayNym) {
|
||||||
|
this.iconData = iconData;
|
||||||
|
this.userIcon = userIcon;
|
||||||
|
this.usePayNym = usePayNym;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getIconData() {
|
||||||
|
return iconData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUserIcon() {
|
||||||
|
return userIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIconData(byte[] iconData, boolean userIcon) {
|
||||||
|
this.iconData = iconData;
|
||||||
|
this.userIcon = userIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUsePayNym() {
|
||||||
|
return usePayNym;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsePayNym(boolean usePayNym) {
|
||||||
|
this.usePayNym = usePayNym;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WalletConfig copy() {
|
||||||
|
return new WalletConfig(iconData, userIcon, usePayNym);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue