mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-17 04:47:28 +00:00
KeyChainGroup: Introduce concept of multiple active keychains.
The newest/last active keychain is the default. Almost all of this class only works on the default active keychain. All other active keychains are meant as fallback for if a sender doesn't understand a certain new script type. New P2WPKH KeyChainGroups are created with a P2PKH fallback chain. This will likely go away in future as P2WPKH and Bech32 are becoming the norm.
This commit is contained in:
@@ -33,6 +33,7 @@ import org.bitcoinj.store.*;
|
||||
import org.bitcoinj.uri.BitcoinURI;
|
||||
import org.bitcoinj.uri.BitcoinURIParseException;
|
||||
import org.bitcoinj.utils.BriefLogFormatter;
|
||||
import org.bitcoinj.wallet.DeterministicKeyChain;
|
||||
import org.bitcoinj.wallet.DeterministicSeed;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -1514,17 +1515,18 @@ public class WalletTool {
|
||||
}
|
||||
|
||||
private static void setCreationTime() {
|
||||
DeterministicSeed seed = wallet.getActiveKeyChain().getSeed();
|
||||
if (seed == null) {
|
||||
System.err.println("Active chain does not have a seed.");
|
||||
return;
|
||||
}
|
||||
long creationTime = getCreationTimeSeconds();
|
||||
for (DeterministicKeyChain chain : wallet.getActiveKeyChains()) {
|
||||
DeterministicSeed seed = chain.getSeed();
|
||||
if (seed == null)
|
||||
System.out.println("Active chain does not have a seed: " + chain);
|
||||
else
|
||||
seed.setCreationTimeSeconds(creationTime);
|
||||
}
|
||||
if (creationTime > 0)
|
||||
System.out.println("Setting creation time to: " + Utils.dateTimeFormat(creationTime * 1000));
|
||||
else
|
||||
System.out.println("Clearing creation time.");
|
||||
seed.setCreationTimeSeconds(creationTime);
|
||||
}
|
||||
|
||||
static synchronized void onChange(final CountDownLatch latch) {
|
||||
|
||||
@@ -61,7 +61,7 @@ Usage: wallet-tool --flags action-name
|
||||
created before this date will be re-spent to a key (from an HD tree) that was created after it.
|
||||
If --date is missing, the current time is assumed. If the time covers all keys, a new HD tree
|
||||
will be created from a new random seed.
|
||||
set-creation-time Modify the creation time of the active chain of this wallet. This is useful for repairing
|
||||
set-creation-time Modify the creation time of the active chains of this wallet. This is useful for repairing
|
||||
wallets that accidently have been created "in the future". Currently, watching wallets are not
|
||||
supported.
|
||||
If --date is specified, that's the creation date.
|
||||
|
||||
Reference in New Issue
Block a user