handle partial rbf, fix cursor reset on payment label

This commit is contained in:
Craig Raw 2021-05-17 11:58:12 +02:00
parent 4f6ead842d
commit c9cdf6e77d
2 changed files with 4 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.protocol.TransactionInput;
import com.sparrowwallet.drongo.protocol.TransactionOutput; import com.sparrowwallet.drongo.protocol.TransactionOutput;
import com.sparrowwallet.drongo.wallet.*; import com.sparrowwallet.drongo.wallet.*;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
@ -168,6 +169,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> {
.map(e -> (HashIndexEntry)e) .map(e -> (HashIndexEntry)e)
.filter(e -> e.getType().equals(HashIndexEntry.Type.INPUT) && e.isSpendable()) .filter(e -> e.getType().equals(HashIndexEntry.Type.INPUT) && e.isSpendable())
.map(e -> blockTransaction.getTransaction().getInputs().get((int)e.getHashIndex().getIndex())) .map(e -> blockTransaction.getTransaction().getInputs().get((int)e.getHashIndex().getIndex()))
.filter(TransactionInput::isReplaceByFeeEnabled)
.map(txInput -> walletTxos.keySet().stream().filter(txo -> txo.getHash().equals(txInput.getOutpoint().getHash()) && txo.getIndex() == txInput.getOutpoint().getIndex()).findFirst().get()) .map(txInput -> walletTxos.keySet().stream().filter(txo -> txo.getHash().equals(txInput.getOutpoint().getHash()) && txo.getIndex() == txInput.getOutpoint().getIndex()).findFirst().get())
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -235,7 +237,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> {
} }
private static Double getMaxFeeRate() { private static Double getMaxFeeRate() {
if(AppServices.getTargetBlockFeeRates().isEmpty()) { if(AppServices.getTargetBlockFeeRates() == null || AppServices.getTargetBlockFeeRates().isEmpty()) {
return 100.0; return 100.0;
} }

View file

@ -279,7 +279,7 @@ 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()); address.setText(payment.getAddress().toString());
if(payment.getLabel() != null) { if(payment.getLabel() != null && !label.getText().equals(payment.getLabel())) {
label.setText(payment.getLabel()); label.setText(payment.getLabel());
} }
if(payment.getAmount() >= 0) { if(payment.getAmount() >= 0) {