@Test public void markKeysAsUsed() throws Exception { control.replay(); DeterministicKey key1 = wallet.currentReceiveKey(); Transaction tx1 = FakeTxBuilder.createFakeTx(params, Coin.CENT, key1.toAddress(params)); multiWallet.addPendingDownload(tx1.getHash()); multiWallet.receive(tx1, 0); DeterministicKey key2 = wallet.currentReceiveKey(); assertNotEquals(wallet.currentReceiveKey(), key1); Transaction tx2 = FakeTxBuilder.createFakeTx(params, Coin.CENT, key2.toAddress(params)); multiWallet.addPendingDownload(tx2.getHash()); multiWallet.receive(tx2, 0); assertNotEquals(wallet.currentReceiveKey(), key2); control.verify(); }
@Override public void markKeysAsUsed(Transaction tx) { wallet.lock(); wallet.lockKeychain(); try { KeyChainGroup group = wallet.getKeychain(); List<Object> oldCurrentKeys = getCurrentKeys(group); doMarkKeysAsUsed(tx, group); List<Object> currentKeys = getCurrentKeys(group); while (!currentKeys.equals(oldCurrentKeys)) { for (Transaction oldTx : txs.values()) { doMarkKeysAsUsed(oldTx, group); notifyTransaction(oldTx, false); } oldCurrentKeys = currentKeys; currentKeys = getCurrentKeys(group); } } finally { wallet.unlockKeychain(); wallet.unlock(); } }
ElectrumMultiWallet extends SmartMultiWallet implements WalletExtension, StratumChain.Listener { @Override public void markKeysAsUsed(Transaction tx) { wallet.lock(); wallet.lockKeychain(); try { KeyChainGroup group = wallet.getKeychain(); List<Object> oldCurrentKeys = getCurrentKeys(group); doMarkKeysAsUsed(tx, group); List<Object> currentKeys = getCurrentKeys(group); while (!currentKeys.equals(oldCurrentKeys)) { for (Transaction oldTx : txs.values()) { doMarkKeysAsUsed(oldTx, group); notifyTransaction(oldTx, false); } oldCurrentKeys = currentKeys; currentKeys = getCurrentKeys(group); } } finally { wallet.unlockKeychain(); wallet.unlock(); } } }
ElectrumMultiWallet extends SmartMultiWallet implements WalletExtension, StratumChain.Listener { @Override public void markKeysAsUsed(Transaction tx) { wallet.lock(); wallet.lockKeychain(); try { KeyChainGroup group = wallet.getKeychain(); List<Object> oldCurrentKeys = getCurrentKeys(group); doMarkKeysAsUsed(tx, group); List<Object> currentKeys = getCurrentKeys(group); while (!currentKeys.equals(oldCurrentKeys)) { for (Transaction oldTx : txs.values()) { doMarkKeysAsUsed(oldTx, group); notifyTransaction(oldTx, false); } oldCurrentKeys = currentKeys; currentKeys = getCurrentKeys(group); } } finally { wallet.unlockKeychain(); wallet.unlock(); } } ElectrumMultiWallet(SmartWallet wallet, File baseDirectory);  ElectrumMultiWallet(SmartWallet wallet); }
ElectrumMultiWallet extends SmartMultiWallet implements WalletExtension, StratumChain.Listener { @Override public void markKeysAsUsed(Transaction tx) { wallet.lock(); wallet.lockKeychain(); try { KeyChainGroup group = wallet.getKeychain(); List<Object> oldCurrentKeys = getCurrentKeys(group); doMarkKeysAsUsed(tx, group); List<Object> currentKeys = getCurrentKeys(group); while (!currentKeys.equals(oldCurrentKeys)) { for (Transaction oldTx : txs.values()) { doMarkKeysAsUsed(oldTx, group); notifyTransaction(oldTx, false); } oldCurrentKeys = currentKeys; currentKeys = getCurrentKeys(group); } } finally { wallet.unlockKeychain(); wallet.unlock(); } } ElectrumMultiWallet(SmartWallet wallet, File baseDirectory);  ElectrumMultiWallet(SmartWallet wallet); @Override void addEventListener(MultiWalletEventListener listener, Executor executor); void setCheckpoints(CheckpointManager checkpoints); void setInitialStore(URL url); @Override boolean removeEventListener(MultiWalletEventListener listener); @Override Set<Transaction> getTransactions(); @Override Transaction getTransaction(Sha256Hash hash); @Override Map<Sha256Hash, Transaction> getTransactionPool(WalletTransaction.Pool pool); @Override void markKeysAsUsed(Transaction tx); @Override void completeTx(Wallet.SendRequest req); @Override void commitTx(Transaction tx); @Override List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases, boolean excludeUnsignable); @Override ListenableFuture<Transaction> broadcastTransaction(final Transaction tx); @Override void start(); @Override void startAsync(); @Override void stopAsync(); void stop(); @Override void resetBlockchain(); void safeAwaitClientTerminated(); @Override void awaitDownload(); @Override String getWalletExtensionID(); @Override boolean isWalletExtensionMandatory(); @Override byte[] serializeWalletExtension(); @Override void deserializeWalletExtension(Wallet containingWallet, byte[] data); @Override void onHeight(long height, Block block, boolean isSynced); int currentHeight(); @Override boolean isSynced(); @Override List<VersionMessage> getPeers(); @Override List<StoredBlock> getRecentBlocks(int maxBlocks); }
ElectrumMultiWallet extends SmartMultiWallet implements WalletExtension, StratumChain.Listener { @Override public void markKeysAsUsed(Transaction tx) { wallet.lock(); wallet.lockKeychain(); try { KeyChainGroup group = wallet.getKeychain(); List<Object> oldCurrentKeys = getCurrentKeys(group); doMarkKeysAsUsed(tx, group); List<Object> currentKeys = getCurrentKeys(group); while (!currentKeys.equals(oldCurrentKeys)) { for (Transaction oldTx : txs.values()) { doMarkKeysAsUsed(oldTx, group); notifyTransaction(oldTx, false); } oldCurrentKeys = currentKeys; currentKeys = getCurrentKeys(group); } } finally { wallet.unlockKeychain(); wallet.unlock(); } } ElectrumMultiWallet(SmartWallet wallet, File baseDirectory);  ElectrumMultiWallet(SmartWallet wallet); @Override void addEventListener(MultiWalletEventListener listener, Executor executor); void setCheckpoints(CheckpointManager checkpoints); void setInitialStore(URL url); @Override boolean removeEventListener(MultiWalletEventListener listener); @Override Set<Transaction> getTransactions(); @Override Transaction getTransaction(Sha256Hash hash); @Override Map<Sha256Hash, Transaction> getTransactionPool(WalletTransaction.Pool pool); @Override void markKeysAsUsed(Transaction tx); @Override void completeTx(Wallet.SendRequest req); @Override void commitTx(Transaction tx); @Override List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases, boolean excludeUnsignable); @Override ListenableFuture<Transaction> broadcastTransaction(final Transaction tx); @Override void start(); @Override void startAsync(); @Override void stopAsync(); void stop(); @Override void resetBlockchain(); void safeAwaitClientTerminated(); @Override void awaitDownload(); @Override String getWalletExtensionID(); @Override boolean isWalletExtensionMandatory(); @Override byte[] serializeWalletExtension(); @Override void deserializeWalletExtension(Wallet containingWallet, byte[] data); @Override void onHeight(long height, Block block, boolean isSynced); int currentHeight(); @Override boolean isSynced(); @Override List<VersionMessage> getPeers(); @Override List<StoredBlock> getRecentBlocks(int maxBlocks); static final String EXTENSION_ID; static final int CHECKPOINT_TIME_BUFFER; }