only allow sending to payment codes where a notification transaction has previously been sent, even when already linked

This commit is contained in:
Craig Raw 2026-04-08 13:51:54 +02:00
parent 3068ba3988
commit 1143eaa55f

View File

@ -240,7 +240,7 @@ public class PaymentController extends WalletFormController implements Initializ
recipientBip47Wallet = sendController.getWalletForm().getWallet().getChildWallet(paymentCode, ScriptType.P2PKH);
}
if(recipientBip47Wallet != null) {
if(recipientBip47Wallet != null && hasNotificationTransaction(paymentCode)) {
PayNym payNym = PayNym.fromWallet(recipientBip47Wallet);
Platform.runLater(() -> setPayNym(payNym));
} else if(!paymentCode.equals(sendController.getWalletForm().getWallet().getPaymentCode())) {
@ -585,6 +585,21 @@ public class PaymentController extends WalletFormController implements Initializ
return masterWallet.getChildWallet(new PaymentCode(payNym.paymentCode().toString()), payNym.segwit() ? ScriptType.P2WPKH : ScriptType.P2PKH);
}
private boolean hasNotificationTransaction(PaymentCode externalPaymentCode) {
Wallet masterWallet = sendController.getWalletForm().getMasterWallet();
if(!masterWallet.getNotificationTransaction(externalPaymentCode).isEmpty()) {
return true;
}
for(Wallet childWallet : masterWallet.getChildWallets()) {
if(!childWallet.isNested() && !childWallet.getNotificationTransaction(externalPaymentCode).isEmpty()) {
return true;
}
}
return false;
}
boolean isSentToSamePayNym(PaymentController paymentController) {
return (this != paymentController && payNymProperty.get() != null && payNymProperty.get().paymentCode().equals(paymentController.payNymProperty.get().paymentCode()));
}