mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
use different addresses when sending batched payments to the same paynym
This commit is contained in:
parent
dd3b980c36
commit
84978a3d5d
2 changed files with 23 additions and 0 deletions
|
@ -413,7 +413,11 @@ public class PaymentController extends WalletFormController implements Initializ
|
|||
try {
|
||||
Wallet recipientBip47Wallet = getWalletForPayNym(payNym);
|
||||
if(recipientBip47Wallet != null) {
|
||||
int index = sendController.getPayNymSendIndex(this);
|
||||
WalletNode sendNode = recipientBip47Wallet.getFreshNode(KeyPurpose.SEND);
|
||||
for(int i = 0; i < index; i++) {
|
||||
sendNode = recipientBip47Wallet.getFreshNode(KeyPurpose.SEND, sendNode);
|
||||
}
|
||||
ECKey pubKey = sendNode.getPubKey();
|
||||
Address address = recipientBip47Wallet.getScriptType().getAddress(pubKey);
|
||||
if(sendController.getPaymentTabs().getTabs().size() > 1 || (getRecipientValueSats() != null && getRecipientValueSats() > getRecipientDustThreshold(address)) || maxButton.isSelected()) {
|
||||
|
@ -433,6 +437,11 @@ public class PaymentController extends WalletFormController implements Initializ
|
|||
return masterWallet.getChildWallet(new PaymentCode(payNym.paymentCode().toString()), payNym.segwit() ? ScriptType.P2WPKH : ScriptType.P2PKH);
|
||||
}
|
||||
|
||||
boolean isSentToSamePayNym(PaymentController paymentController) {
|
||||
return (this != paymentController && payNymProperty.get() != null && !payNymProperty.get().isCollaborativeSend()
|
||||
&& payNymProperty.get().paymentCode().equals(paymentController.payNymProperty.get().paymentCode()));
|
||||
}
|
||||
|
||||
private Long getRecipientValueSats() {
|
||||
return getRecipientValueSats(amountUnit.getSelectionModel().getSelectedItem());
|
||||
}
|
||||
|
|
|
@ -542,6 +542,20 @@ public class SendController extends WalletFormController implements Initializabl
|
|||
}
|
||||
}
|
||||
|
||||
int getPayNymSendIndex(PaymentController paymentController) {
|
||||
int index = 0;
|
||||
for(Tab tab : paymentTabs.getTabs()) {
|
||||
PaymentController controller = (PaymentController)tab.getUserData();
|
||||
if(controller == paymentController) {
|
||||
break;
|
||||
} else if(controller.isSentToSamePayNym(paymentController)) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
public void updateTransaction() {
|
||||
updateTransaction(null);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue