mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 17:26:28 +01:00
WalletTool: When specifying ALL as a value of an output, use the correct BalanceType suitable for the value of --allow-unconfirmed.
This commit is contained in:
parent
5b785f8c9c
commit
d3505b8949
1 changed files with 7 additions and 6 deletions
|
@ -628,11 +628,12 @@ public class WalletTool implements Callable<Integer> {
|
||||||
for (String spec : outputs) {
|
for (String spec : outputs) {
|
||||||
try {
|
try {
|
||||||
OutputSpec outputSpec = new OutputSpec(spec);
|
OutputSpec outputSpec = new OutputSpec(spec);
|
||||||
if (outputSpec.isAddress()) {
|
Coin value = outputSpec.value != null ? outputSpec.value :
|
||||||
t.addOutput(outputSpec.value, outputSpec.addr);
|
wallet.getBalance(allowUnconfirmed ? BalanceType.ESTIMATED : BalanceType.AVAILABLE);
|
||||||
} else {
|
if (outputSpec.isAddress())
|
||||||
t.addOutput(outputSpec.value, outputSpec.key);
|
t.addOutput(value, outputSpec.addr);
|
||||||
}
|
else
|
||||||
|
t.addOutput(value, outputSpec.key);
|
||||||
} catch (AddressFormatException.WrongNetwork e) {
|
} catch (AddressFormatException.WrongNetwork e) {
|
||||||
System.err.println("Malformed output specification, address is for a different network: " + spec);
|
System.err.println("Malformed output specification, address is for a different network: " + spec);
|
||||||
return;
|
return;
|
||||||
|
@ -716,7 +717,7 @@ public class WalletTool implements Callable<Integer> {
|
||||||
}
|
}
|
||||||
String destination = parts[0];
|
String destination = parts[0];
|
||||||
if ("ALL".equalsIgnoreCase(parts[1]))
|
if ("ALL".equalsIgnoreCase(parts[1]))
|
||||||
value = wallet.getBalance(BalanceType.ESTIMATED);
|
value = null;
|
||||||
else
|
else
|
||||||
value = parseCoin(parts[1]);
|
value = parseCoin(parts[1]);
|
||||||
if (destination.startsWith("0")) {
|
if (destination.startsWith("0")) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue