mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 20:36:44 +00:00
utxo grouping, filtering and zero conf handling
This commit is contained in:
parent
4d51bb40c2
commit
3cee45223e
8 changed files with 45 additions and 14 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
|||
Subproject commit 832ca8f257559864823c83d8d29dc2276f44fa51
|
||||
Subproject commit f00754b15779e94faa65c3de5c0a977cc51d865b
|
|
@ -37,7 +37,8 @@ public class DateCell extends TreeTableCell<Entry, Entry> {
|
|||
setText(date);
|
||||
setContextMenu(new DateContextMenu(date, utxoEntry.getHashIndex()));
|
||||
Tooltip tooltip = new Tooltip();
|
||||
tooltip.setText(Integer.toString(utxoEntry.getHashIndex().getHeight()));
|
||||
int height = utxoEntry.getHashIndex().getHeight();
|
||||
tooltip.setText(height > 0 ? Integer.toString(height) : "Mempool");
|
||||
setTooltip(tooltip);
|
||||
}
|
||||
setGraphic(null);
|
||||
|
@ -58,7 +59,7 @@ public class DateCell extends TreeTableCell<Entry, Entry> {
|
|||
copyHeight.setOnAction(AE -> {
|
||||
hide();
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(Integer.toString(reference.getHeight()));
|
||||
content.putString(reference.getHeight() > 0 ? Integer.toString(reference.getHeight()) : "Mempool");
|
||||
Clipboard.getSystemClipboard().setContent(content);
|
||||
});
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class EntryCell extends TreeTableCell<Entry, Entry> {
|
|||
copyHeight.setOnAction(AE -> {
|
||||
hide();
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(Integer.toString(blockTransaction.getHeight()));
|
||||
content.putString(blockTransaction.getHeight() > 0 ? Integer.toString(blockTransaction.getHeight()) : "Mempool");
|
||||
Clipboard.getSystemClipboard().setContent(content);
|
||||
});
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ public class Config {
|
|||
private BitcoinUnit bitcoinUnit;
|
||||
private Currency fiatCurrency;
|
||||
private ExchangeSource exchangeSource;
|
||||
private boolean groupByAddress = true;
|
||||
private boolean includeMempoolChange = true;
|
||||
private Integer keyDerivationPeriod;
|
||||
private File hwi;
|
||||
private String electrumServer;
|
||||
|
@ -99,6 +101,24 @@ public class Config {
|
|||
flush();
|
||||
}
|
||||
|
||||
public boolean isGroupByAddress() {
|
||||
return groupByAddress;
|
||||
}
|
||||
|
||||
public void setGroupByAddress(boolean groupByAddress) {
|
||||
this.groupByAddress = groupByAddress;
|
||||
flush();
|
||||
}
|
||||
|
||||
public boolean isIncludeMempoolChange() {
|
||||
return includeMempoolChange;
|
||||
}
|
||||
|
||||
public void setIncludeMempoolChange(boolean includeMempoolChange) {
|
||||
this.includeMempoolChange = includeMempoolChange;
|
||||
flush();
|
||||
}
|
||||
|
||||
public Integer getKeyDerivationPeriod() {
|
||||
return keyDerivationPeriod;
|
||||
}
|
||||
|
|
|
@ -299,7 +299,9 @@ public class ElectrumServer {
|
|||
try {
|
||||
Set<Integer> blockHeights = new TreeSet<>();
|
||||
for(BlockTransactionHash reference : references) {
|
||||
blockHeights.add(reference.getHeight());
|
||||
if(reference.getHeight() > 0) {
|
||||
blockHeights.add(reference.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
JsonRpcClient client = new JsonRpcClient(getTransport());
|
||||
|
@ -378,14 +380,20 @@ public class ElectrumServer {
|
|||
}
|
||||
BlockTransactionHash reference = optionalReference.get();
|
||||
|
||||
BlockHeader blockHeader = blockHeaderMap.get(reference.getHeight());
|
||||
if(blockHeader == null) {
|
||||
transactionMap.put(hash, UNFETCHABLE_BLOCK_TRANSACTION);
|
||||
checkReferences.removeIf(ref -> ref.getHash().equals(hash));
|
||||
continue;
|
||||
Date blockDate;
|
||||
if(reference.getHeight() > 0) {
|
||||
BlockHeader blockHeader = blockHeaderMap.get(reference.getHeight());
|
||||
if(blockHeader == null) {
|
||||
transactionMap.put(hash, UNFETCHABLE_BLOCK_TRANSACTION);
|
||||
checkReferences.removeIf(ref -> ref.getHash().equals(hash));
|
||||
continue;
|
||||
}
|
||||
blockDate = blockHeader.getTimeAsDate();
|
||||
} else {
|
||||
blockDate = new Date();
|
||||
}
|
||||
|
||||
BlockTransaction blockchainTransaction = new BlockTransaction(reference.getHash(), reference.getHeight(), blockHeader.getTimeAsDate(), reference.getFee(), transaction);
|
||||
BlockTransaction blockchainTransaction = new BlockTransaction(reference.getHash(), reference.getHeight(), blockDate, reference.getFee(), transaction);
|
||||
|
||||
transactionMap.put(hash, blockchainTransaction);
|
||||
checkReferences.remove(reference);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class HashIndexEntry extends Entry implements Comparable<HashIndexEntry>
|
|||
}
|
||||
|
||||
if(getHashIndex().getHeight() != o.getHashIndex().getHeight()) {
|
||||
return o.getHashIndex().getHeight() - getHashIndex().getHeight();
|
||||
return (o.getHashIndex().getHeight() > 0 ? o.getHashIndex().getHeight() : Integer.MAX_VALUE) - (getHashIndex().getHeight() > 0 ? getHashIndex().getHeight() : Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
return (int)o.getHashIndex().getIndex() - (int)getHashIndex().getIndex();
|
||||
|
|
|
@ -300,7 +300,9 @@ public class SendController extends WalletFormController implements Initializabl
|
|||
if(recipientAmount != null && recipientAmount > recipientDustThreshold && (!userFeeSet.get() || (getFeeValueSats() != null && getFeeValueSats() > 0))) {
|
||||
Wallet wallet = getWalletForm().getWallet();
|
||||
Long userFee = userFeeSet.get() ? getFeeValueSats() : null;
|
||||
WalletTransaction walletTransaction = wallet.createWalletTransaction(getUtxoSelectors(), recipientAddress, recipientAmount, getFeeRate(), getMinimumFeeRate(), userFee, sendAll);
|
||||
boolean groupByAddress = Config.get().isGroupByAddress();
|
||||
boolean includeMempoolChange = Config.get().isIncludeMempoolChange();
|
||||
WalletTransaction walletTransaction = wallet.createWalletTransaction(getUtxoSelectors(), recipientAddress, recipientAmount, getFeeRate(), getMinimumFeeRate(), userFee, sendAll, groupByAddress, includeMempoolChange);
|
||||
walletTransactionProperty.setValue(walletTransaction);
|
||||
insufficientInputsProperty.set(false);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
|
|||
}
|
||||
|
||||
public int calculateConfirmations() {
|
||||
if(blockTransaction.getHeight() == 0) {
|
||||
if(blockTransaction.getHeight() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue