From b40b3a5f9db23109eb123d9f5e4e2be83cfc1bd9 Mon Sep 17 00:00:00 2001 From: troggy <7r0ggy@gmail.com> Date: Wed, 11 Jun 2014 23:50:30 +0400 Subject: [PATCH] Fix failing WalletProtobufSerializerTest --- .../java/com/google/bitcoin/wallet/KeyChainGroup.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/wallet/KeyChainGroup.java b/core/src/main/java/com/google/bitcoin/wallet/KeyChainGroup.java index a80f3761..bcb0ee01 100644 --- a/core/src/main/java/com/google/bitcoin/wallet/KeyChainGroup.java +++ b/core/src/main/java/com/google/bitcoin/wallet/KeyChainGroup.java @@ -446,10 +446,12 @@ public class KeyChainGroup { public static KeyChainGroup fromProtobufUnencrypted(List keys) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List chains = DeterministicKeyChain.fromProtobuf(keys, null); - EnumMap currentKeys = createCurrentKeysMap(chains); + EnumMap currentKeys = null; if (chains.isEmpty()) { // TODO: Old bag-of-keys style wallet only! Auto-upgrade time! + } else { + currentKeys = createCurrentKeysMap(chains); } return new KeyChainGroup(basicKeyChain, chains, currentKeys, null); } @@ -458,10 +460,12 @@ public class KeyChainGroup { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter); List chains = DeterministicKeyChain.fromProtobuf(keys, crypter); - EnumMap currentKeys = createCurrentKeysMap(chains); + EnumMap currentKeys = null; if (chains.isEmpty()) { // TODO: Old bag-of-keys style wallet only! Auto-upgrade time! + } else { + currentKeys = createCurrentKeysMap(chains); } return new KeyChainGroup(basicKeyChain, chains, currentKeys, crypter); }