mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 10:45:51 +00:00
Javadoc and other cleanup
This commit is contained in:
parent
3dd7ba1de5
commit
7012791601
@ -112,6 +112,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
// is somewhat arbitrary but can be useful for audits. The first number is the "account number" but we don't use
|
// is somewhat arbitrary but can be useful for audits. The first number is the "account number" but we don't use
|
||||||
// that feature yet. In future we might hand out different accounts for cases where we wish to hand payers
|
// that feature yet. In future we might hand out different accounts for cases where we wish to hand payers
|
||||||
// a payment request that can generate lots of addresses independently.
|
// a payment request that can generate lots of addresses independently.
|
||||||
|
// The account path may be overridden by subclasses.
|
||||||
public static final ImmutableList<ChildNumber> ACCOUNT_ZERO_PATH = ImmutableList.of(ChildNumber.ZERO_HARDENED);
|
public static final ImmutableList<ChildNumber> ACCOUNT_ZERO_PATH = ImmutableList.of(ChildNumber.ZERO_HARDENED);
|
||||||
public static final ImmutableList<ChildNumber> EXTERNAL_SUBPATH = ImmutableList.of(ChildNumber.ZERO);
|
public static final ImmutableList<ChildNumber> EXTERNAL_SUBPATH = ImmutableList.of(ChildNumber.ZERO);
|
||||||
public static final ImmutableList<ChildNumber> INTERNAL_SUBPATH = ImmutableList.of(ChildNumber.ONE);
|
public static final ImmutableList<ChildNumber> INTERNAL_SUBPATH = ImmutableList.of(ChildNumber.ONE);
|
||||||
@ -366,6 +367,9 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
return new DeterministicKeyChain(accountKey, seedCreationTimeSecs);
|
return new DeterministicKeyChain(accountKey, seedCreationTimeSecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For use in {@link KeyChainFactory} during deserialization.
|
||||||
|
*/
|
||||||
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter) {
|
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter) {
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
basicKeyChain = new BasicKeyChain(crypter);
|
basicKeyChain = new BasicKeyChain(crypter);
|
||||||
@ -430,6 +434,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Override in subclasses to use a different account derivation path */
|
||||||
protected ImmutableList<ChildNumber> getAccountPath() {
|
protected ImmutableList<ChildNumber> getAccountPath() {
|
||||||
return ACCOUNT_ZERO_PATH;
|
return ACCOUNT_ZERO_PATH;
|
||||||
}
|
}
|
||||||
@ -1004,7 +1009,6 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
|||||||
* Subclasses should override this to create an instance of the subclass instead of a plain DKC.
|
* Subclasses should override this to create an instance of the subclass instead of a plain DKC.
|
||||||
* This is used in encryption/decryption.
|
* This is used in encryption/decryption.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected DeterministicKeyChain makeKeyChainFromSeed(DeterministicSeed seed) {
|
protected DeterministicKeyChain makeKeyChainFromSeed(DeterministicSeed seed) {
|
||||||
return new DeterministicKeyChain(seed);
|
return new DeterministicKeyChain(seed);
|
||||||
}
|
}
|
||||||
|
@ -764,15 +764,17 @@ public class KeyChainGroup implements KeyBag {
|
|||||||
// kinds of KeyPurpose are introduced.
|
// kinds of KeyPurpose are introduced.
|
||||||
if (activeChain.getIssuedExternalKeys() > 0) {
|
if (activeChain.getIssuedExternalKeys() > 0) {
|
||||||
DeterministicKey currentExternalKey = activeChain.getKeyByPath(
|
DeterministicKey currentExternalKey = activeChain.getKeyByPath(
|
||||||
Lists.newArrayList(ImmutableList.<ChildNumber>builder().addAll(activeChain.getAccountPath()).add(ChildNumber.ZERO, new ChildNumber(activeChain.getIssuedExternalKeys() - 1)).build())
|
HDUtils.append(
|
||||||
);
|
HDUtils.concat(activeChain.getAccountPath(), DeterministicKeyChain.EXTERNAL_SUBPATH),
|
||||||
|
new ChildNumber(activeChain.getIssuedExternalKeys() - 1)));
|
||||||
currentKeys.put(KeyChain.KeyPurpose.RECEIVE_FUNDS, currentExternalKey);
|
currentKeys.put(KeyChain.KeyPurpose.RECEIVE_FUNDS, currentExternalKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeChain.getIssuedInternalKeys() > 0) {
|
if (activeChain.getIssuedInternalKeys() > 0) {
|
||||||
DeterministicKey currentInternalKey = activeChain.getKeyByPath(
|
DeterministicKey currentInternalKey = activeChain.getKeyByPath(
|
||||||
Lists.newArrayList(ImmutableList.<ChildNumber>builder().addAll(activeChain.getAccountPath()).add(new ChildNumber(1), new ChildNumber(activeChain.getIssuedInternalKeys() - 1)).build())
|
HDUtils.append(
|
||||||
);
|
HDUtils.concat(activeChain.getAccountPath(), DeterministicKeyChain.INTERNAL_SUBPATH),
|
||||||
|
new ChildNumber(activeChain.getIssuedInternalKeys() - 1)));
|
||||||
currentKeys.put(KeyChain.KeyPurpose.CHANGE, currentInternalKey);
|
currentKeys.put(KeyChain.KeyPurpose.CHANGE, currentInternalKey);
|
||||||
}
|
}
|
||||||
return currentKeys;
|
return currentKeys;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user