set bip47 wallet label before creating addresses

This commit is contained in:
Craig Raw 2022-03-17 10:33:47 +02:00
parent 04cb27f85e
commit 95d8201bd9
4 changed files with 7 additions and 11 deletions

2
drongo

@ -1 +1 @@
Subproject commit 640176153016e6b38b367d6d7e37ecf15cfee745
Subproject commit fe57ad3e7a16fac968910f6581075fdbd79e10a8

View file

@ -1717,12 +1717,8 @@ public class ElectrumServer {
PayNym payNym = Config.get().isUsePayNym() ? getPayNym(paymentCode) : null;
List<ScriptType> scriptTypes = payNym == null || wallet.getScriptType() != ScriptType.P2PKH ? PayNym.getSegwitScriptTypes() : payNym.getScriptTypes();
for(ScriptType childScriptType : scriptTypes) {
Wallet addedWallet = wallet.addChildWallet(paymentCode, childScriptType, output, blkTx);
if(payNym != null) {
addedWallet.setLabel(payNym.nymName() + " " + childScriptType.getName());
} else {
addedWallet.setLabel(paymentCode.toAbbreviatedString() + " " + childScriptType.getName());
}
String label = (payNym == null ? paymentCode.toAbbreviatedString() : payNym.nymName()) + " " + childScriptType.getName();
Wallet addedWallet = wallet.addChildWallet(paymentCode, childScriptType, output, blkTx, label);
//Check this is a valid payment code, will throw IllegalArgumentException if not
try {
WalletNode receiveNode = new WalletNode(addedWallet, KeyPurpose.RECEIVE, 0);

View file

@ -421,8 +421,8 @@ public class PayNymController {
Storage storage = AppServices.get().getOpenWallets().get(masterWallet);
List<ScriptType> scriptTypes = masterWallet.getScriptType() != ScriptType.P2PKH ? PayNym.getSegwitScriptTypes() : payNym.getScriptTypes();
for(ScriptType childScriptType : scriptTypes) {
Wallet addedWallet = masterWallet.addChildWallet(externalPaymentCode, childScriptType);
addedWallet.setLabel(payNym.nymName() + " " + childScriptType.getName());
String label = payNym.nymName() + " " + childScriptType.getName();
Wallet addedWallet = masterWallet.addChildWallet(externalPaymentCode, childScriptType, label);
if(!storage.isPersisted(addedWallet)) {
try {
storage.saveWallet(addedWallet);

View file

@ -1349,8 +1349,8 @@ public class SendController extends WalletFormController implements Initializabl
Storage storage = AppServices.get().getOpenWallets().get(masterWallet);
List<ScriptType> scriptTypes = PayNym.getSegwitScriptTypes();
for(ScriptType childScriptType : scriptTypes) {
Wallet addedWallet = masterWallet.addChildWallet(externalPaymentCode, childScriptType);
addedWallet.setLabel((payNym == null ? externalPaymentCode.toAbbreviatedString() : payNym.nymName()) + " " + childScriptType.getName());
String label = (payNym == null ? externalPaymentCode.toAbbreviatedString() : payNym.nymName()) + " " + childScriptType.getName();
Wallet addedWallet = masterWallet.addChildWallet(externalPaymentCode, childScriptType, label);
if(!storage.isPersisted(addedWallet)) {
try {
storage.saveWallet(addedWallet);