mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 13:26:44 +00:00
improve variable naming for utxo selection criteria
This commit is contained in:
parent
b836774289
commit
18075e0686
8 changed files with 24 additions and 25 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
|||
Subproject commit a25dfa5c7671023b60d1773cf603b4d46885a546
|
||||
Subproject commit efaa6a066d2b7d7f982086060aa8f014ca89a190
|
|
@ -11,18 +11,18 @@ public class SpendUtxoEvent {
|
|||
private final List<BlockTransactionHashIndex> utxos;
|
||||
private final List<Payment> payments;
|
||||
private final Long fee;
|
||||
private final boolean includeMempoolInputs;
|
||||
private final boolean includeSpentMempoolOutputs;
|
||||
|
||||
public SpendUtxoEvent(Wallet wallet, List<BlockTransactionHashIndex> utxos) {
|
||||
this(wallet, utxos, null, null, false);
|
||||
}
|
||||
|
||||
public SpendUtxoEvent(Wallet wallet, List<BlockTransactionHashIndex> utxos, List<Payment> payments, Long fee, boolean includeMempoolInputs) {
|
||||
public SpendUtxoEvent(Wallet wallet, List<BlockTransactionHashIndex> utxos, List<Payment> payments, Long fee, boolean includeSpentMempoolOutputs) {
|
||||
this.wallet = wallet;
|
||||
this.utxos = utxos;
|
||||
this.payments = payments;
|
||||
this.fee = fee;
|
||||
this.includeMempoolInputs = includeMempoolInputs;
|
||||
this.includeSpentMempoolOutputs = includeSpentMempoolOutputs;
|
||||
}
|
||||
|
||||
public Wallet getWallet() {
|
||||
|
@ -41,7 +41,7 @@ public class SpendUtxoEvent {
|
|||
return fee;
|
||||
}
|
||||
|
||||
public boolean isIncludeMempoolInputs() {
|
||||
return includeMempoolInputs;
|
||||
public boolean isIncludeSpentMempoolOutputs() {
|
||||
return includeSpentMempoolOutputs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class Config {
|
|||
private boolean loadRecentWallets = true;
|
||||
private boolean validateDerivationPaths = true;
|
||||
private boolean groupByAddress = true;
|
||||
private boolean includeMempoolChange = true;
|
||||
private boolean includeMempoolOutputs = true;
|
||||
private boolean notifyNewTransactions = true;
|
||||
private boolean checkNewVersions = true;
|
||||
private Theme theme;
|
||||
|
@ -183,12 +183,12 @@ public class Config {
|
|||
flush();
|
||||
}
|
||||
|
||||
public boolean isIncludeMempoolChange() {
|
||||
return includeMempoolChange;
|
||||
public boolean isIncludeMempoolOutputs() {
|
||||
return includeMempoolOutputs;
|
||||
}
|
||||
|
||||
public void setIncludeMempoolChange(boolean includeMempoolChange) {
|
||||
this.includeMempoolChange = includeMempoolChange;
|
||||
public void setIncludeMempoolOutputs(boolean includeMempoolOutputs) {
|
||||
this.includeMempoolOutputs = includeMempoolOutputs;
|
||||
flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
private UnlabeledToggleSwitch groupByAddress;
|
||||
|
||||
@FXML
|
||||
private UnlabeledToggleSwitch includeMempoolChange;
|
||||
private UnlabeledToggleSwitch includeMempoolOutputs;
|
||||
|
||||
@FXML
|
||||
private UnlabeledToggleSwitch notifyNewTransactions;
|
||||
|
@ -113,12 +113,12 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
});
|
||||
|
||||
groupByAddress.setSelected(config.isGroupByAddress());
|
||||
includeMempoolChange.setSelected(config.isIncludeMempoolChange());
|
||||
includeMempoolOutputs.setSelected(config.isIncludeMempoolOutputs());
|
||||
groupByAddress.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
config.setGroupByAddress(newValue);
|
||||
});
|
||||
includeMempoolChange.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
config.setIncludeMempoolChange(newValue);
|
||||
includeMempoolOutputs.selectedProperty().addListener((observableValue, oldValue, newValue) -> {
|
||||
config.setIncludeMempoolOutputs(newValue);
|
||||
});
|
||||
|
||||
notifyNewTransactions.setSelected(config.isNotifyNewTransactions());
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HashIndexEntry extends Entry implements Comparable<HashIndexEntry>
|
|||
}
|
||||
|
||||
public boolean isSpendable() {
|
||||
return !isSpent() && (hashIndex.getHeight() > 0 || Config.get().isIncludeMempoolChange()) && (hashIndex.getStatus() == null || hashIndex.getStatus() != Status.FROZEN);
|
||||
return !isSpent() && (hashIndex.getHeight() > 0 || Config.get().isIncludeMempoolOutputs()) && (hashIndex.getStatus() == null || hashIndex.getStatus() != Status.FROZEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,6 @@ import java.net.URL;
|
|||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SendController extends WalletFormController implements Initializable {
|
||||
|
@ -128,7 +127,7 @@ public class SendController extends WalletFormController implements Initializabl
|
|||
|
||||
private final StringProperty utxoLabelSelectionProperty = new SimpleStringProperty("");
|
||||
|
||||
private final BooleanProperty includeMempoolInputsProperty = new SimpleBooleanProperty(false);
|
||||
private final BooleanProperty includeSpentMempoolOutputsProperty = new SimpleBooleanProperty(false);
|
||||
|
||||
private final ChangeListener<String> feeListener = new ChangeListener<>() {
|
||||
@Override
|
||||
|
@ -480,9 +479,9 @@ public class SendController extends WalletFormController implements Initializabl
|
|||
Long userFee = userFeeSet.get() ? getFeeValueSats() : null;
|
||||
Integer currentBlockHeight = AppServices.getCurrentBlockHeight();
|
||||
boolean groupByAddress = Config.get().isGroupByAddress();
|
||||
boolean includeMempoolChange = Config.get().isIncludeMempoolChange();
|
||||
boolean includeMempoolInputs = includeMempoolInputsProperty.get();
|
||||
WalletTransaction walletTransaction = wallet.createWalletTransaction(getUtxoSelectors(), getUtxoFilters(), payments, getFeeRate(), getMinimumFeeRate(), userFee, currentBlockHeight, groupByAddress, includeMempoolChange, includeMempoolInputs);
|
||||
boolean includeMempoolOutputs = Config.get().isIncludeMempoolOutputs();
|
||||
boolean includeSpentMempoolOutputs = includeSpentMempoolOutputsProperty.get();
|
||||
WalletTransaction walletTransaction = wallet.createWalletTransaction(getUtxoSelectors(), getUtxoFilters(), payments, getFeeRate(), getMinimumFeeRate(), userFee, currentBlockHeight, groupByAddress, includeMempoolOutputs, includeSpentMempoolOutputs);
|
||||
walletTransactionProperty.setValue(walletTransaction);
|
||||
insufficientInputsProperty.set(false);
|
||||
|
||||
|
@ -791,7 +790,7 @@ public class SendController extends WalletFormController implements Initializabl
|
|||
setDefaultFeeRate();
|
||||
utxoSelectorProperty.setValue(null);
|
||||
utxoFilterProperty.setValue(null);
|
||||
includeMempoolInputsProperty.set(false);
|
||||
includeSpentMempoolOutputsProperty.set(false);
|
||||
walletTransactionProperty.setValue(null);
|
||||
createdWalletTransactionProperty.set(null);
|
||||
|
||||
|
@ -957,7 +956,7 @@ public class SendController extends WalletFormController implements Initializabl
|
|||
userFeeSet.set(true);
|
||||
}
|
||||
|
||||
includeMempoolInputsProperty.set(event.isIncludeMempoolInputs());
|
||||
includeSpentMempoolOutputsProperty.set(event.isIncludeSpentMempoolOutputs());
|
||||
|
||||
List<BlockTransactionHashIndex> utxos = event.getUtxos();
|
||||
utxoSelectorProperty.set(new PresetUtxoSelector(utxos));
|
||||
|
|
|
@ -38,7 +38,7 @@ public class WalletTransactionsEntry extends Entry {
|
|||
|
||||
for(Entry entry : getChildren()) {
|
||||
TransactionEntry transactionEntry = (TransactionEntry)entry;
|
||||
if(transactionEntry.getConfirmations() != 0 || transactionEntry.getValue() < 0 || Config.get().isIncludeMempoolChange()) {
|
||||
if(transactionEntry.getConfirmations() != 0 || transactionEntry.getValue() < 0 || Config.get().isIncludeMempoolOutputs()) {
|
||||
balance += entry.getValue();
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<HelpLabel helpText="Group UTXOs by address when sending to improve privacy by only sending from an address once."/>
|
||||
</Field>
|
||||
<Field text="Allow unconfirmed:">
|
||||
<UnlabeledToggleSwitch fx:id="includeMempoolChange" />
|
||||
<UnlabeledToggleSwitch fx:id="includeMempoolOutputs" />
|
||||
<HelpLabel helpText="Allow a wallet to spend UTXOs that are still in the mempool."/>
|
||||
</Field>
|
||||
</Fieldset>
|
||||
|
|
Loading…
Reference in a new issue