mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 01:56:44 +00:00
minor changes to support adding additional rbf tx inputs
This commit is contained in:
parent
b26c5e5218
commit
5b9b3043a6
3 changed files with 23 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
package com.sparrowwallet.drongo.wallet;
|
package com.sparrowwallet.drongo.wallet;
|
||||||
|
|
||||||
public class InsufficientFundsException extends Exception {
|
public class InsufficientFundsException extends Exception {
|
||||||
|
private Long targetValue;
|
||||||
|
|
||||||
public InsufficientFundsException() {
|
public InsufficientFundsException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -8,4 +10,13 @@ public class InsufficientFundsException extends Exception {
|
||||||
public InsufficientFundsException(String msg) {
|
public InsufficientFundsException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InsufficientFundsException(String message, Long targetValue) {
|
||||||
|
super(message);
|
||||||
|
this.targetValue = targetValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTargetValue() {
|
||||||
|
return targetValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,22 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class PresetUtxoSelector extends SingleSetUtxoSelector {
|
public class PresetUtxoSelector extends SingleSetUtxoSelector {
|
||||||
private final Collection<BlockTransactionHashIndex> presetUtxos;
|
private final Collection<BlockTransactionHashIndex> presetUtxos;
|
||||||
|
private final Collection<BlockTransactionHashIndex> excludedUtxos;
|
||||||
private final boolean maintainOrder;
|
private final boolean maintainOrder;
|
||||||
|
|
||||||
public PresetUtxoSelector(Collection<BlockTransactionHashIndex> presetUtxos) {
|
public PresetUtxoSelector(Collection<BlockTransactionHashIndex> presetUtxos) {
|
||||||
|
this(presetUtxos, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PresetUtxoSelector(Collection<BlockTransactionHashIndex> presetUtxos, Collection<BlockTransactionHashIndex> excludedUtxos) {
|
||||||
this.presetUtxos = presetUtxos;
|
this.presetUtxos = presetUtxos;
|
||||||
|
this.excludedUtxos = excludedUtxos;
|
||||||
this.maintainOrder = false;
|
this.maintainOrder = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PresetUtxoSelector(Collection<BlockTransactionHashIndex> presetUtxos, boolean maintainOrder) {
|
public PresetUtxoSelector(Collection<BlockTransactionHashIndex> presetUtxos, boolean maintainOrder) {
|
||||||
this.presetUtxos = presetUtxos;
|
this.presetUtxos = presetUtxos;
|
||||||
|
this.excludedUtxos = new ArrayList<>();
|
||||||
this.maintainOrder = maintainOrder;
|
this.maintainOrder = maintainOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +51,10 @@ public class PresetUtxoSelector extends SingleSetUtxoSelector {
|
||||||
return presetUtxos;
|
return presetUtxos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<BlockTransactionHashIndex> getExcludedUtxos() {
|
||||||
|
return excludedUtxos;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shuffleInputs() {
|
public boolean shuffleInputs() {
|
||||||
return !maintainOrder;
|
return !maintainOrder;
|
||||||
|
|
|
@ -1224,7 +1224,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InsufficientFundsException("Not enough combined value in UTXOs for output value " + targetValue);
|
throw new InsufficientFundsException("Not enough combined value in UTXOs for output value " + targetValue, targetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OutputGroup> getGroupedUtxos(List<UtxoFilter> utxoFilters, double feeRate, double longTermFeeRate, boolean groupByAddress, boolean includeSpentMempoolOutputs) {
|
private List<OutputGroup> getGroupedUtxos(List<UtxoFilter> utxoFilters, double feeRate, double longTermFeeRate, boolean groupByAddress, boolean includeSpentMempoolOutputs) {
|
||||||
|
|
Loading…
Reference in a new issue