public void addAccount() { mLogger.info("add account"); // Make sure we are in a good state for this. if (mState != State.READY) { mLogger.warn("can't add an account until the wallet is ready"); return; } mHDWallet.addAccount(); mHDWallet.ensureMargins(mKit.wallet()); // Set the new keys creation time to now. long now = Utils.now().getTime() / 1000; // Adding all the keys is overkill, but it is simpler for now. ArrayList<ECKey> keys = new ArrayList<ECKey>(); mHDWallet.gatherAllKeys(now, keys); mLogger.info(String.format("adding %d keys", keys.size())); mKit.wallet().addKeys(keys); mHDWallet.persist(mApp); }