3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 02:35:52 +00:00

DeterministicKeyChain: Fix a conditional and.

This commit is contained in:
Andreas Schildbach 2018-04-21 16:14:31 +02:00
parent 2c370c07c7
commit c3d162d9b4

View File

@ -912,13 +912,12 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
// If this is not a following chain and previous was, this must be married // If this is not a following chain and previous was, this must be married
boolean isMarried = !isFollowingKey && !chains.isEmpty() && chains.get(chains.size() - 1).isFollowing(); boolean isMarried = !isFollowingKey && !chains.isEmpty() && chains.get(chains.size() - 1).isFollowing();
// If this has a private key but no seed, then all we know is the spending key H // If this has a private key but no seed, then all we know is the spending key H
if (seed == null & key.hasSecretBytes()) { if (seed == null && key.hasSecretBytes()) {
DeterministicKey accountKey = new DeterministicKey(immutablePath, chainCode, pubkey, new BigInteger(1, key.getSecretBytes().toByteArray()), null); DeterministicKey accountKey = new DeterministicKey(immutablePath, chainCode, pubkey, new BigInteger(1, key.getSecretBytes().toByteArray()), null);
accountKey.setCreationTimeSeconds(key.getCreationTimestamp() / 1000); accountKey.setCreationTimeSeconds(key.getCreationTimestamp() / 1000);
chain = factory.makeSpendingKeyChain(key, iter.peek(), accountKey, isMarried); chain = factory.makeSpendingKeyChain(key, iter.peek(), accountKey, isMarried);
isSpendingKey = true; isSpendingKey = true;
} } else if (seed == null) {
else if (seed == null) {
DeterministicKey accountKey = new DeterministicKey(immutablePath, chainCode, pubkey, null, null); DeterministicKey accountKey = new DeterministicKey(immutablePath, chainCode, pubkey, null, null);
accountKey.setCreationTimeSeconds(key.getCreationTimestamp() / 1000); accountKey.setCreationTimeSeconds(key.getCreationTimestamp() / 1000);
chain = factory.makeWatchingKeyChain(key, iter.peek(), accountKey, isFollowingKey, isMarried); chain = factory.makeWatchingKeyChain(key, iter.peek(), accountKey, isFollowingKey, isMarried);