mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-02 00:31:24 +00:00
Married HD wallets: Bloom filter adjustments
Pull request: #115 Based on design notes: https://groups.google.com/forum/#!msg/bitcoinj/Uxl-z40OLuQ/e2m4mEWR6gMJ
This commit is contained in:
@@ -80,6 +80,7 @@ public class WalletTool {
|
||||
private static OptionSpec<Date> dateFlag;
|
||||
private static OptionSpec<Integer> unixtimeFlag;
|
||||
private static OptionSpec<String> seedFlag, watchFlag;
|
||||
private static OptionSpec<String> xpubkeysFlag;
|
||||
|
||||
private static NetworkParameters params;
|
||||
private static File walletFile;
|
||||
@@ -162,6 +163,7 @@ public class WalletTool {
|
||||
SEND,
|
||||
ENCRYPT,
|
||||
DECRYPT,
|
||||
MARRY
|
||||
}
|
||||
|
||||
public enum WaitForEnum {
|
||||
@@ -202,6 +204,7 @@ public class WalletTool {
|
||||
parser.accepts("privkey").withRequiredArg();
|
||||
parser.accepts("addr").withRequiredArg();
|
||||
parser.accepts("peers").withRequiredArg();
|
||||
xpubkeysFlag = parser.accepts("xpubkeys").withRequiredArg();
|
||||
OptionSpec<String> outputFlag = parser.accepts("output").withRequiredArg();
|
||||
parser.accepts("value").withRequiredArg();
|
||||
parser.accepts("fee").withRequiredArg();
|
||||
@@ -352,6 +355,7 @@ public class WalletTool {
|
||||
break;
|
||||
case ENCRYPT: encrypt(); break;
|
||||
case DECRYPT: decrypt(); break;
|
||||
case MARRY: marry(); break;
|
||||
}
|
||||
|
||||
if (!wallet.isConsistent()) {
|
||||
@@ -380,6 +384,19 @@ public class WalletTool {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
private static void marry() {
|
||||
if (!options.has(xpubkeysFlag)) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
String[] xpubkeys = options.valueOf(xpubkeysFlag).split(",");
|
||||
ImmutableList.Builder<DeterministicKey> keys = ImmutableList.builder();
|
||||
for (String xpubkey : xpubkeys) {
|
||||
keys.add(DeterministicKey.deserializeB58(null, xpubkey.trim()));
|
||||
}
|
||||
wallet.addFollowingAccountKeys(keys.build());
|
||||
}
|
||||
|
||||
private static void encrypt() {
|
||||
if (password == null) {
|
||||
System.err.println("You must provide a --password");
|
||||
|
@@ -9,6 +9,8 @@ Usage: wallet-tool --flags action-name
|
||||
create Makes a new wallet in the file specified by --wallet.
|
||||
Will complain and require --force if the wallet already exists.
|
||||
If --seed is present, it should specify either a mnemonic code or hex/base58 raw seed bytes.
|
||||
marry Makes the wallet married with other parties, requiring multisig to spend funds.
|
||||
External public keys for other signing parties must be specified with --xpubkeys (comma separated).
|
||||
add-key Adds a new key to the wallet, either specified or freshly generated.
|
||||
If --date is specified, that's the creation date.
|
||||
If --unixtime is specified, that's the creation time and it overrides --date.
|
||||
|
Reference in New Issue
Block a user