3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 07:12:17 +00:00

HDW: Clear some static analysis warnings from DKC.

This commit is contained in:
Mike Hearn 2014-08-11 14:15:06 +02:00
parent 0d2fb93536
commit 53aa33c2e8

View File

@ -253,6 +253,10 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
// For use in encryption.
private DeterministicKeyChain(KeyCrypter crypter, KeyParameter aesKey, DeterministicKeyChain chain) {
// Can't encrypt a watching chain.
checkNotNull(chain.rootKey);
checkNotNull(chain.seed);
checkArgument(!chain.rootKey.isEncrypted(), "Chain already encrypted");
this.issuedExternalKeys = chain.issuedExternalKeys;
@ -752,6 +756,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
@Override
public DeterministicKeyChain toDecrypted(KeyParameter aesKey) {
checkState(getKeyCrypter() != null, "Key chain not encrypted");
checkState(seed != null, "Can't decrypt a watching chain");
checkState(seed.isEncrypted());
String passphrase = DEFAULT_PASSPHRASE_FOR_MNEMONIC; // FIXME allow non-empty passphrase
DeterministicSeed decSeed = seed.decrypt(getKeyCrypter(), passphrase, aesKey);
@ -786,6 +791,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
@Override
public boolean checkAESKey(KeyParameter aesKey) {
checkState(rootKey != null, "Can't check password for a watching chain");
checkNotNull(aesKey);
checkState(getKeyCrypter() != null, "Key chain not encrypted");
try {