set send amount to total utxo value when sending selected utxos before an address or label is added

This commit is contained in:
Craig Raw 2021-05-21 09:53:00 +02:00
parent 94088f795c
commit dd146210ba
2 changed files with 6 additions and 1 deletions

View file

@ -278,7 +278,9 @@ public class PaymentController extends WalletFormController implements Initializ
public void setPayment(Payment payment) { public void setPayment(Payment payment) {
if(getRecipientValueSats() == null || payment.getAmount() != getRecipientValueSats()) { if(getRecipientValueSats() == null || payment.getAmount() != getRecipientValueSats()) {
address.setText(payment.getAddress().toString()); if(payment.getAddress() != null) {
address.setText(payment.getAddress().toString());
}
if(payment.getLabel() != null && !label.getText().equals(payment.getLabel())) { if(payment.getLabel() != null && !label.getText().equals(payment.getLabel())) {
label.setText(payment.getLabel()); label.setText(payment.getLabel());
} }

View file

@ -1063,6 +1063,9 @@ public class SendController extends WalletFormController implements Initializabl
if(event.getPayments() != null) { if(event.getPayments() != null) {
clear(null); clear(null);
setPayments(event.getPayments()); setPayments(event.getPayments());
} else if(paymentTabs.getTabs().size() == 1) {
Payment payment = new Payment(null, null, event.getUtxos().stream().mapToLong(BlockTransactionHashIndex::getValue).sum(), true);
setPayments(List.of(payment));
} }
if(event.getFee() != null) { if(event.getFee() != null) {