Skip to content

Commit

Permalink
#445 ensured MBHD_SOFT_BIP32 parsed ok
Browse files Browse the repository at this point in the history
  • Loading branch information
jim618 committed Mar 9, 2015
1 parent 55fa1d4 commit 29cd808
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void deserializeWalletExtension(Wallet containingWallet, byte[] data) thr
if (WalletType.MBHD_SOFT_WALLET.name().equals(serialisedString)) {
walletType = WalletType.MBHD_SOFT_WALLET;
} else if (WalletType.TREZOR_SOFT_WALLET.name().equals(serialisedString)) {
walletType = WalletType.TREZOR_SOFT_WALLET;
walletType = WalletType.TREZOR_SOFT_WALLET;
} else if (WalletType.MBHD_SOFT_WALLET_BIP32.name().equals(serialisedString)) {
walletType = WalletType.MBHD_SOFT_WALLET_BIP32;
} else if (WalletType.TREZOR_HARD_WALLET.name().equals(serialisedString)) {
walletType = WalletType.TREZOR_HARD_WALLET;
} else if (WalletType.UNKNOWN.name().equals(serialisedString)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ private void updateConfigurationAndCheckSync(

// Remember the current soft wallet root
if (WalletType.MBHD_SOFT_WALLET == walletSummary.getWalletType() ||
WalletType.MBHD_SOFT_WALLET_BIP32 == walletSummary.getWalletType() ||
WalletType.TREZOR_SOFT_WALLET == walletSummary.getWalletType()) {
if (Configurations.currentConfiguration != null) {
Configurations.currentConfiguration.getWallet().setLastSoftWalletRoot(walletRoot);
Expand Down Expand Up @@ -956,7 +957,7 @@ private void inferWalletType(Wallet wallet) {
if (firstLeafKeyPath != null && firstLeafKeyPath.size() > 0) {
// MBHD soft wallets start at m/0h
if (ChildNumber.ZERO_HARDENED.equals(firstLeafKeyPath.get(0))) {
inferredWalletType = WalletType.MBHD_SOFT_WALLET;
inferredWalletType = WalletType.MBHD_SOFT_WALLET_BIP32;
} else if ((new ChildNumber(44 | ChildNumber.HARDENED_BIT)).equals(firstLeafKeyPath.get(0))) {
// Trezor wallet
if (firstLeafKey.isEncrypted()) {
Expand Down Expand Up @@ -1217,6 +1218,7 @@ public static List<WalletSummary> getSoftWalletSummaries(final Optional<Locale>

for (WalletSummary walletSummary : allWalletSummaries) {
if (WalletType.MBHD_SOFT_WALLET == walletSummary.getWalletType()
|| WalletType.MBHD_SOFT_WALLET_BIP32 == walletSummary.getWalletType()
|| WalletType.TREZOR_SOFT_WALLET == walletSummary.getWalletType()) {
softWalletSummaries.add(walletSummary);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class WalletTypeExtensionTest {
private static final Logger log = LoggerFactory.getLogger(WalletTypeExtension.class);

public static final String EXPECTED_MBHD_SOFT_WALLET_TYPE = "MBHD_SOFT_WALLET";
public static final String EXPECTED_TREZOR_SOFT_WALLET_TYPE = "TREZOR_SOFT_WALLET";
public static final String EXPECTED_MBHD_SOFT_WALLET_BIP32_TYPE = "MBHD_SOFT_WALLET_BIP32";
public static final String EXPECTED_TREZOR_SOFT_WALLET_TYPE = "TREZOR_SOFT_WALLET";
public static final String EXPECTED_TREZOR_HARD_WALLET_TYPE = "TREZOR_HARD_WALLET";
public static final String EXPECTED_UNKNOWN_WALLET_TYPE = "UNKNOWN";

Expand All @@ -39,11 +40,16 @@ public void setUp() throws Exception {
}

@Test
public void testMBHDSoftWalletType() throws Exception {
testWalletType(WalletType.MBHD_SOFT_WALLET, EXPECTED_MBHD_SOFT_WALLET_TYPE);
public void testMBHDSoftBIP32WalletType() throws Exception {
testWalletType(WalletType.MBHD_SOFT_WALLET_BIP32, EXPECTED_MBHD_SOFT_WALLET_BIP32_TYPE);
}

@Test
public void testMBHDSoftWalletType() throws Exception {
testWalletType(WalletType.MBHD_SOFT_WALLET, EXPECTED_MBHD_SOFT_WALLET_TYPE);
}

@Test
public void testTrezorSoftWalletType() throws Exception {
testWalletType(WalletType.TREZOR_SOFT_WALLET, EXPECTED_TREZOR_SOFT_WALLET_TYPE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ core_verify_message_verify_failure=The message was NOT signed by the specified a

core_wallet_capabilities=Wallet capabilities
core_wallet_capability_mbhd_soft_beta7=Beta 7 MultiBit HD wallet\nPrivate keys are encrypted on this machine\nNot BIP32 compliant. m/0h (Account 1 only)
core_wallet_capability_mbhd_soft_bip32==Standard MultiBit HD wallet\nPrivate keys are encrypted on this machine\nBIP32 compliant. m/0h (Account 1 only)
core_wallet_capability_mbhd_soft_bip32=Standard MultiBit HD wallet\nPrivate keys are encrypted on this machine\nBIP32 compliant. m/0h (Account 1 only)
core_wallet_capability_trezor_hard=Trezor signed wallet\nPrivate keys are held on device\nBIP44 m/44h/0h/0h (Account 1 only)
core_wallet_capability_trezor_soft=Trezor compatible wallet\nPrivate keys are encrypted on this machine\nBIP44 m/44h/0h/0h (Account 1 only)
core_wallet_capability_unknown=This version of MultiBit HD does not know the full capabilities of this wallet
Expand Down

0 comments on commit 29cd808

Please sign in to comment.