ensure deep copy of child wallets

This commit is contained in:
Craig Raw 2021-06-16 09:37:05 +02:00
parent f407547c47
commit 729c3a1435

View file

@ -1139,7 +1139,11 @@ public class Wallet extends Persistable {
Wallet copy = new Wallet(name); Wallet copy = new Wallet(name);
copy.setId(getId()); copy.setId(getId());
copy.setMasterWallet(masterWallet); copy.setMasterWallet(masterWallet);
copy.setChildWallets(childWallets); for(Wallet childWallet : childWallets) {
Wallet copyChildWallet = childWallet.copy();
copyChildWallet.setMasterWallet(copy);
copy.childWallets.add(copyChildWallet);
}
copy.setPolicyType(policyType); copy.setPolicyType(policyType);
copy.setScriptType(scriptType); copy.setScriptType(scriptType);
copy.setDefaultPolicy(defaultPolicy.copy()); copy.setDefaultPolicy(defaultPolicy.copy());