mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 03:35:52 +00:00
DeterministicKeyChain: Make accountPath final. It's not meant to be changed.
This commit is contained in:
parent
b08cfe3f54
commit
2c370c07c7
@ -105,7 +105,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
private DeterministicHierarchy hierarchy;
|
private DeterministicHierarchy hierarchy;
|
||||||
@Nullable private DeterministicKey rootKey;
|
@Nullable private DeterministicKey rootKey;
|
||||||
@Nullable private DeterministicSeed seed;
|
@Nullable private DeterministicSeed seed;
|
||||||
@Nullable private ImmutableList<ChildNumber> accountPath;
|
@Nullable private final ImmutableList<ChildNumber> accountPath;
|
||||||
|
|
||||||
// Paths through the key tree. External keys are ones that are communicated to other parties. Internal keys are
|
// Paths through the key tree. External keys are ones that are communicated to other parties. Internal keys are
|
||||||
// keys created for change addresses, coinbases, mixing, etc - anything that isn't communicated. The distinction
|
// keys created for change addresses, coinbases, mixing, etc - anything that isn't communicated. The distinction
|
||||||
@ -323,7 +323,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
*/
|
*/
|
||||||
public DeterministicKeyChain(DeterministicKey watchingKey) {
|
public DeterministicKeyChain(DeterministicKey watchingKey) {
|
||||||
checkArgument(watchingKey.isPubKeyOnly(), "Private subtrees not currently supported: if you got this key from DKC.getWatchingKey() then use .dropPrivate().dropParent() on it first.");
|
checkArgument(watchingKey.isPubKeyOnly(), "Private subtrees not currently supported: if you got this key from DKC.getWatchingKey() then use .dropPrivate().dropParent() on it first.");
|
||||||
setAccountPath(watchingKey.getPath());
|
this.accountPath = watchingKey.getPath();
|
||||||
basicKeyChain = new BasicKeyChain();
|
basicKeyChain = new BasicKeyChain();
|
||||||
this.seed = null;
|
this.seed = null;
|
||||||
this.rootKey = null;
|
this.rootKey = null;
|
||||||
@ -352,7 +352,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
this.rootKey = null;
|
this.rootKey = null;
|
||||||
basicKeyChain.importKey(key);
|
basicKeyChain.importKey(key);
|
||||||
hierarchy = new DeterministicHierarchy(key);
|
hierarchy = new DeterministicHierarchy(key);
|
||||||
setAccountPath(key.getPath());
|
this.accountPath = key.getPath();
|
||||||
initializeHierarchyUnencrypted(key);
|
initializeHierarchyUnencrypted(key);
|
||||||
this.isFollowing = isFollowing;
|
this.isFollowing = isFollowing;
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
*/
|
*/
|
||||||
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter,
|
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter,
|
||||||
ImmutableList<ChildNumber> accountPath) {
|
ImmutableList<ChildNumber> accountPath) {
|
||||||
setAccountPath(accountPath);
|
this.accountPath = accountPath;
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
basicKeyChain = new BasicKeyChain(crypter);
|
basicKeyChain = new BasicKeyChain(crypter);
|
||||||
if (!seed.isEncrypted()) {
|
if (!seed.isEncrypted()) {
|
||||||
@ -433,7 +433,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
checkNotNull(chain.seed);
|
checkNotNull(chain.seed);
|
||||||
|
|
||||||
checkArgument(!chain.rootKey.isEncrypted(), "Chain already encrypted");
|
checkArgument(!chain.rootKey.isEncrypted(), "Chain already encrypted");
|
||||||
setAccountPath(chain.getAccountPath());
|
this.accountPath = chain.getAccountPath();
|
||||||
|
|
||||||
this.issuedExternalKeys = chain.issuedExternalKeys;
|
this.issuedExternalKeys = chain.issuedExternalKeys;
|
||||||
this.issuedInternalKeys = chain.issuedInternalKeys;
|
this.issuedInternalKeys = chain.issuedInternalKeys;
|
||||||
@ -475,11 +475,6 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
return ACCOUNT_ZERO_PATH;
|
return ACCOUNT_ZERO_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Store account path of this DeterministicKey */
|
|
||||||
protected void setAccountPath(ImmutableList<ChildNumber> accountPath) {
|
|
||||||
this.accountPath = accountPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain,
|
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain,
|
||||||
DeterministicKey parent, ImmutableList<ChildNumber> path) {
|
DeterministicKey parent, ImmutableList<ChildNumber> path) {
|
||||||
DeterministicKey key = chain.hierarchy.get(path, false, false);
|
DeterministicKey key = chain.hierarchy.get(path, false, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user