private static Protos.Wallet updateV2toV3Proto(Protos.Wallet walletProto) { checkState(walletProto.getVersion() < 3, "Can update only from version < 3"); Protos.Wallet.Builder b = walletProto.toBuilder(); for (int i = 0; i < b.getPocketsCount(); i++) { Protos.WalletPocket.Builder account = b.getPocketsBuilder(i); // pre v2 wallets were saving the coin name in the description account.clearDescription(); } return b.build(); }
private static Protos.Wallet updateV1toV2Proto(Protos.Wallet walletProto) { checkState(walletProto.getVersion() < 2, "Can update only from version < 2"); // Purge blockchain data if wallet is bigger than 2mb boolean purgeBlockchain = walletProto.getSerializedSize() > 200000; Protos.Wallet.Builder b = walletProto.toBuilder(); for (int i = 0; i < b.getPocketsCount(); i++) { Protos.WalletPocket.Builder account = b.getPocketsBuilder(i); // Purge blockchain data if needed if (purgeBlockchain) { account.clearAddressStatus(); account.clearLastSeenBlockHash(); account.clearLastSeenBlockHeight(); account.clearLastSeenBlockTimeSecs(); account.clearTransaction(); } // Update coin type ids if (account.getNetworkIdentifier().equals("dogecoindark.main")) { account.setNetworkIdentifier("verge.main"); b.setPockets(i, account); } if (account.getNetworkIdentifier().equals("darkcoin.main")) { account.setNetworkIdentifier("dash.main"); b.setPockets(i, account); } } return b.build(); }
public final boolean isInitialized() { if (!hasMasterKey()) { return false; } if (hasSeed()) { if (!getSeed().isInitialized()) { return false; } } if (!getMasterKey().isInitialized()) { return false; } if (hasEncryptionParameters()) { if (!getEncryptionParameters().isInitialized()) { return false; } } for (int i = 0; i < getPocketsCount(); i++) { if (!getPockets(i).isInitialized()) { return false; } } return true; }