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) {
|
||||
try {
|
||||
OutputSpec outputSpec = new OutputSpec(spec);
|
||||
if (outputSpec.isAddress()) {
|
||||
t.addOutput(outputSpec.value, outputSpec.addr);
|
||||
} else {
|
||||
t.addOutput(outputSpec.value, outputSpec.key);
|
||||
}
|
||||
Coin value = outputSpec.value != null ? outputSpec.value :
|
||||
wallet.getBalance(allowUnconfirmed ? BalanceType.ESTIMATED : BalanceType.AVAILABLE);
|
||||
if (outputSpec.isAddress())
|
||||
t.addOutput(value, outputSpec.addr);
|
||||
else
|
||||
t.addOutput(value, outputSpec.key);
|
||||
} catch (AddressFormatException.WrongNetwork e) {
|
||||
System.err.println("Malformed output specification, address is for a different network: " + spec);
|
||||
return;
|
||||
|
@ -716,7 +717,7 @@ public class WalletTool implements Callable<Integer> {
|
|||
}
|
||||
String destination = parts[0];
|
||||
if ("ALL".equalsIgnoreCase(parts[1]))
|
||||
value = wallet.getBalance(BalanceType.ESTIMATED);
|
||||
value = null;
|
||||
else
|
||||
value = parseCoin(parts[1]);
|
||||
if (destination.startsWith("0")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue