mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 13:22:42 +01:00
WalletTool: New option --fee-sat-per-byte to set network fee in satoshi per byte.
This commit is contained in:
parent
d3dca96a3c
commit
9dd8e5ab92
@ -224,6 +224,7 @@ public class WalletTool {
|
||||
OptionSpec<String> outputFlag = parser.accepts("output").withRequiredArg();
|
||||
parser.accepts("value").withRequiredArg();
|
||||
OptionSpec<String> feePerKbOption = parser.accepts("fee-per-kb").withRequiredArg();
|
||||
OptionSpec<String> feeSatPerByteOption = parser.accepts("fee-sat-per-byte").withRequiredArg();
|
||||
unixtimeFlag = parser.accepts("unixtime").withRequiredArg().ofType(Long.class);
|
||||
OptionSpec<String> conditionFlag = parser.accepts("condition").withRequiredArg();
|
||||
parser.accepts("locktime").withRequiredArg();
|
||||
@ -359,10 +360,15 @@ public class WalletTool {
|
||||
if (options.has(paymentRequestLocation) && options.has(outputFlag)) {
|
||||
System.err.println("--payment-request and --output cannot be used together.");
|
||||
return;
|
||||
} else if (options.has(feePerKbOption) && options.has(feeSatPerByteOption)) {
|
||||
System.err.println("--fee-per-kb and --fee-sat-per-byte cannot be used together.");
|
||||
return;
|
||||
} else if (options.has(outputFlag)) {
|
||||
Coin feePerKb = null;
|
||||
if (options.has(feePerKbOption))
|
||||
feePerKb = parseCoin((String) options.valueOf(feePerKbOption));
|
||||
if (options.has(feeSatPerByteOption))
|
||||
feePerKb = Coin.valueOf(Long.parseLong(options.valueOf(feeSatPerByteOption)) * 1000);
|
||||
String lockTime = null;
|
||||
if (options.has("locktime")) {
|
||||
lockTime = (String) options.valueOf("locktime");
|
||||
@ -377,6 +383,10 @@ public class WalletTool {
|
||||
}
|
||||
break;
|
||||
case SEND_CLTVPAYMENTCHANNEL: {
|
||||
if (options.has(feePerKbOption) && options.has(feeSatPerByteOption)) {
|
||||
System.err.println("--fee-per-kb and --fee-sat-per-byte cannot be used together.");
|
||||
return;
|
||||
}
|
||||
if (!options.has(outputFlag)) {
|
||||
System.err.println("You must specify a --output=addr:value");
|
||||
return;
|
||||
@ -384,6 +394,8 @@ public class WalletTool {
|
||||
Coin feePerKb = null;
|
||||
if (options.has(feePerKbOption))
|
||||
feePerKb = parseCoin((String) options.valueOf(feePerKbOption));
|
||||
if (options.has(feeSatPerByteOption))
|
||||
feePerKb = Coin.valueOf(Long.parseLong(options.valueOf(feeSatPerByteOption)) * 1000);
|
||||
if (!options.has("locktime")) {
|
||||
System.err.println("You must specify a --locktime");
|
||||
return;
|
||||
@ -397,6 +409,10 @@ public class WalletTool {
|
||||
sendCLTVPaymentChannel(refundFlag.value(options), outputFlag.value(options), feePerKb, lockTime, allowUnconfirmed);
|
||||
} break;
|
||||
case SETTLE_CLTVPAYMENTCHANNEL: {
|
||||
if (options.has(feePerKbOption) && options.has(feeSatPerByteOption)) {
|
||||
System.err.println("--fee-per-kb and --fee-sat-per-byte cannot be used together.");
|
||||
return;
|
||||
}
|
||||
if (!options.has(outputFlag)) {
|
||||
System.err.println("You must specify a --output=addr:value");
|
||||
return;
|
||||
@ -404,6 +420,8 @@ public class WalletTool {
|
||||
Coin feePerKb = null;
|
||||
if (options.has(feePerKbOption))
|
||||
feePerKb = parseCoin((String) options.valueOf(feePerKbOption));
|
||||
if (options.has(feeSatPerByteOption))
|
||||
feePerKb = Coin.valueOf(Long.parseLong(options.valueOf(feeSatPerByteOption)) * 1000);
|
||||
boolean allowUnconfirmed = options.has("allow-unconfirmed");
|
||||
if (!options.has(txHashFlag)) {
|
||||
System.err.println("You must specify the transaction to spend: --txhash=tx-hash");
|
||||
@ -412,6 +430,10 @@ public class WalletTool {
|
||||
settleCLTVPaymentChannel(txHashFlag.value(options), outputFlag.value(options), feePerKb, allowUnconfirmed);
|
||||
} break;
|
||||
case REFUND_CLTVPAYMENTCHANNEL: {
|
||||
if (options.has(feePerKbOption) && options.has(feeSatPerByteOption)) {
|
||||
System.err.println("--fee-per-kb and --fee-sat-per-byte cannot be used together.");
|
||||
return;
|
||||
}
|
||||
if (!options.has(outputFlag)) {
|
||||
System.err.println("You must specify a --output=addr:value");
|
||||
return;
|
||||
@ -419,6 +441,8 @@ public class WalletTool {
|
||||
Coin feePerKb = null;
|
||||
if (options.has(feePerKbOption))
|
||||
feePerKb = parseCoin((String) options.valueOf(feePerKbOption));
|
||||
if (options.has(feeSatPerByteOption))
|
||||
feePerKb = Coin.valueOf(Long.parseLong(options.valueOf(feeSatPerByteOption)) * 1000);
|
||||
boolean allowUnconfirmed = options.has("allow-unconfirmed");
|
||||
if (!options.has(txHashFlag)) {
|
||||
System.err.println("You must specify the transaction to spend: --txhash=tx-hash");
|
||||
|
@ -49,7 +49,7 @@ Usage: wallet-tool --flags action-name
|
||||
--payment-request=http://merchant.com/pay.php?123
|
||||
|
||||
Other options include:
|
||||
--fee-per-kb=0.0005 sets the tx fee
|
||||
--fee-per-kb=0.0005 or --fee-sat-per-byte=50 sets the network fee
|
||||
--locktime=1234 sets the lock time to block 1234
|
||||
--locktime=2013/01/01 sets the lock time to 1st Jan 2013
|
||||
--allow-unconfirmed will let you create spends of pending non-change outputs.
|
||||
@ -73,14 +73,14 @@ Usage: wallet-tool --flags action-name
|
||||
Options:
|
||||
--output=pubkey:value sets the amount to lock and the recipient
|
||||
--refund-to=pubkey sets "our" public key
|
||||
--fee-per-kb=value sets the network fee
|
||||
--fee-per-kb=0.0005 or --fee-sat-per-byte=50 sets the network fee
|
||||
--locktime=YYYY/MM/DD sets the expiry time for the channel
|
||||
settle-cltvpaymentchannel
|
||||
Creates and broadcasts a transaction settling a previous micropayment channel.
|
||||
This tool, for testing, requires the presence of both private keys.
|
||||
Options:
|
||||
--output=pubkey:value sets the destination for the money
|
||||
--fee-per-kb=value sets the network fee
|
||||
--fee-per-kb=0.0005 or --fee-sat-per-byte=50 sets the network fee
|
||||
--txhash=hash sets the transaction to spend
|
||||
refund-cltvpaymentchannel
|
||||
Creates and broadcasts a transaction refunding a previous micropayment channel.
|
||||
@ -88,7 +88,7 @@ Usage: wallet-tool --flags action-name
|
||||
the created transaction won't be accepted into the mempool until that point.
|
||||
Options:
|
||||
--output=pubkey:value sets the destination for the money
|
||||
--fee-per-kb=value sets the network fee
|
||||
--fee-per-kb=0.0005 or --fee-sat-per-byte=50 sets the network fee
|
||||
--txhash=hash sets the transaction to spend
|
||||
|
||||
>>> GENERAL OPTIONS
|
||||
|
Loading…
Reference in New Issue
Block a user