mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-13 19:07:12 +00:00
WalletTool: magic --output value ALL for easier emptying of wallets.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
package org.bitcoinj.tools;
|
package org.bitcoinj.tools;
|
||||||
|
|
||||||
import org.bitcoinj.core.*;
|
import org.bitcoinj.core.*;
|
||||||
|
import org.bitcoinj.core.Wallet.BalanceType;
|
||||||
import org.bitcoinj.crypto.DeterministicKey;
|
import org.bitcoinj.crypto.DeterministicKey;
|
||||||
import org.bitcoinj.crypto.KeyCrypterException;
|
import org.bitcoinj.crypto.KeyCrypterException;
|
||||||
import org.bitcoinj.crypto.MnemonicCode;
|
import org.bitcoinj.crypto.MnemonicCode;
|
||||||
@@ -517,7 +518,11 @@ public class WalletTool {
|
|||||||
}
|
}
|
||||||
String destination = parts[0];
|
String destination = parts[0];
|
||||||
try {
|
try {
|
||||||
Coin value = parseCoin(parts[1]);
|
Coin value;
|
||||||
|
if ("ALL".equalsIgnoreCase(parts[1]))
|
||||||
|
value = wallet.getBalance(BalanceType.ESTIMATED);
|
||||||
|
else
|
||||||
|
value = parseCoin(parts[1]);
|
||||||
if (destination.startsWith("0")) {
|
if (destination.startsWith("0")) {
|
||||||
// Treat as a raw public key.
|
// Treat as a raw public key.
|
||||||
byte[] pubKey = new BigInteger(destination, 16).toByteArray();
|
byte[] pubKey = new BigInteger(destination, 16).toByteArray();
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ Usage: wallet-tool --flags action-name
|
|||||||
send Creates and broadcasts a transaction from the given wallet.
|
send Creates and broadcasts a transaction from the given wallet.
|
||||||
Requires either --output or --payment-request to be specified.
|
Requires either --output or --payment-request to be specified.
|
||||||
If --output is specified, a transaction is created from the provided output
|
If --output is specified, a transaction is created from the provided output
|
||||||
from this wallet and broadcasted, eg:
|
from this wallet and broadcasted, e.g.:
|
||||||
--output=1GthXFQMktFLWdh5EPNGqbq3H6WdG8zsWj:1.245
|
--output=1GthXFQMktFLWdh5EPNGqbq3H6WdG8zsWj:1.245
|
||||||
You can repeat --output=address:value multiple times.
|
You can repeat --output=address:value multiple times.
|
||||||
|
There is a magic value ALL which empties the wallet to that address, e.g.:
|
||||||
|
--output=1GthXFQMktFLWdh5EPNGqbq3H6WdG8zsWj:ALL
|
||||||
If the output destination starts with 04 and is 65 or 33 bytes long it will be
|
If the output destination starts with 04 and is 65 or 33 bytes long it will be
|
||||||
treated as a public key instead of an address and the send will use
|
treated as a public key instead of an address and the send will use
|
||||||
<key> CHECKSIG as the script.
|
<key> CHECKSIG as the script.
|
||||||
|
|||||||
Reference in New Issue
Block a user