@Test public void sortTxnsByDependency() throws Exception { CoinSelector originalCoinSelector = wallet.getCoinSelector(); try { wallet.allowSpendingUnconfirmedTransactions(); Transaction send1 = sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, valueOf(2, 0)); Transaction send1a = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(1, 0))); wallet.commitTx(send1a); Transaction send1b = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(0, 50))); wallet.commitTx(send1b); Transaction send1c = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(0, 25))); wallet.commitTx(send1c); Transaction send1d = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(0, 12))); wallet.commitTx(send1d); Transaction send1e = checkNotNull(wallet.createSend(OTHER_ADDRESS, valueOf(0, 06))); wallet.commitTx(send1e); Transaction send2 = sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, valueOf(200, 0)); SendRequest req2a = SendRequest.to(OTHER_ADDRESS, valueOf(100, 0)); req2a.tx.addInput(send2.getOutput(0)); req2a.shuffleOutputs = false; wallet.completeTx(req2a); Transaction send2a = req2a.tx; SendRequest req2b = SendRequest.to(OTHER_ADDRESS, valueOf(50, 0)); req2b.tx.addInput(send2a.getOutput(1)); req2b.shuffleOutputs = false; wallet.completeTx(req2b); Transaction send2b = req2b.tx; SendRequest req2c = SendRequest.to(OTHER_ADDRESS, valueOf(25, 0)); req2c.tx.addInput(send2b.getOutput(1)); req2c.shuffleOutputs = false; wallet.completeTx(req2c); Transaction send2c = req2c.tx; Set<Transaction> unsortedTxns = new HashSet<Transaction>(); unsortedTxns.add(send1a); unsortedTxns.add(send1b); unsortedTxns.add(send1c); unsortedTxns.add(send1d); unsortedTxns.add(send1e); unsortedTxns.add(send2a); unsortedTxns.add(send2b); unsortedTxns.add(send2c); List<Transaction> sortedTxns = wallet.sortTxnsByDependency(unsortedTxns); assertEquals(8, sortedTxns.size()); assertTrue(sortedTxns.indexOf(send1a) < sortedTxns.indexOf(send1b)); assertTrue(sortedTxns.indexOf(send1b) < sortedTxns.indexOf(send1c)); assertTrue(sortedTxns.indexOf(send1c) < sortedTxns.indexOf(send1d)); assertTrue(sortedTxns.indexOf(send1d) < sortedTxns.indexOf(send1e)); assertTrue(sortedTxns.indexOf(send2a) < sortedTxns.indexOf(send2b)); assertTrue(sortedTxns.indexOf(send2b) < sortedTxns.indexOf(send2c)); } finally { wallet.setCoinSelector(originalCoinSelector); } }
List<Transaction> sortTxnsByDependency(Set<Transaction> inputSet) { ArrayList<Transaction> result = new ArrayList<Transaction>(inputSet); for (int i = 0; i < result.size()-1; i++) { boolean txAtISpendsOtherTxInTheList; do { txAtISpendsOtherTxInTheList = false; for (int j = i+1; j < result.size(); j++) { if (spends(result.get(i), result.get(j))) { Transaction transactionAtI = result.remove(i); result.add(j, transactionAtI); txAtISpendsOtherTxInTheList = true; break; } } } while (txAtISpendsOtherTxInTheList); } return result; }
Wallet extends BaseTaggableObject implements NewBestBlockListener, TransactionReceivedInBlockListener, PeerFilterProvider, KeyBag, TransactionBag, ReorganizeListener { List<Transaction> sortTxnsByDependency(Set<Transaction> inputSet) { ArrayList<Transaction> result = new ArrayList<Transaction>(inputSet); for (int i = 0; i < result.size()-1; i++) { boolean txAtISpendsOtherTxInTheList; do { txAtISpendsOtherTxInTheList = false; for (int j = i+1; j < result.size(); j++) { if (spends(result.get(i), result.get(j))) { Transaction transactionAtI = result.remove(i); result.add(j, transactionAtI); txAtISpendsOtherTxInTheList = true; break; } } } while (txAtISpendsOtherTxInTheList); } return result; } }
Wallet extends BaseTaggableObject implements NewBestBlockListener, TransactionReceivedInBlockListener, PeerFilterProvider, KeyBag, TransactionBag, ReorganizeListener { List<Transaction> sortTxnsByDependency(Set<Transaction> inputSet) { ArrayList<Transaction> result = new ArrayList<Transaction>(inputSet); for (int i = 0; i < result.size()-1; i++) { boolean txAtISpendsOtherTxInTheList; do { txAtISpendsOtherTxInTheList = false; for (int j = i+1; j < result.size(); j++) { if (spends(result.get(i), result.get(j))) { Transaction transactionAtI = result.remove(i); result.add(j, transactionAtI); txAtISpendsOtherTxInTheList = true; break; } } } while (txAtISpendsOtherTxInTheList); } return result; } Wallet(NetworkParameters params);  Wallet(Context context);  Wallet(NetworkParameters params, KeyChainGroup keyChainGroup); private  Wallet(Context context, KeyChainGroup keyChainGroup); }
Wallet extends BaseTaggableObject implements NewBestBlockListener, TransactionReceivedInBlockListener, PeerFilterProvider, KeyBag, TransactionBag, ReorganizeListener { List<Transaction> sortTxnsByDependency(Set<Transaction> inputSet) { ArrayList<Transaction> result = new ArrayList<Transaction>(inputSet); for (int i = 0; i < result.size()-1; i++) { boolean txAtISpendsOtherTxInTheList; do { txAtISpendsOtherTxInTheList = false; for (int j = i+1; j < result.size(); j++) { if (spends(result.get(i), result.get(j))) { Transaction transactionAtI = result.remove(i); result.add(j, transactionAtI); txAtISpendsOtherTxInTheList = true; break; } } } while (txAtISpendsOtherTxInTheList); } return result; } Wallet(NetworkParameters params);  Wallet(Context context);  Wallet(NetworkParameters params, KeyChainGroup keyChainGroup); private  Wallet(Context context, KeyChainGroup keyChainGroup); static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed); static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed, ImmutableList<ChildNumber> accountPath); static Wallet fromWatchingKey(NetworkParameters params, DeterministicKey watchKey); static Wallet fromWatchingKeyB58(NetworkParameters params, String watchKeyB58, long creationTimeSeconds); static Wallet fromKeys(NetworkParameters params, List<ECKey> keys); NetworkParameters getNetworkParameters(); DeterministicKeyChain getActiveKeyChain(); final void addTransactionSigner(TransactionSigner signer); List<TransactionSigner> getTransactionSigners(); DeterministicKey currentKey(KeyChain.KeyPurpose purpose); DeterministicKey currentReceiveKey(); Address currentAddress(KeyChain.KeyPurpose purpose); Address currentReceiveAddress(); DeterministicKey freshKey(KeyChain.KeyPurpose purpose); List<DeterministicKey> freshKeys(KeyChain.KeyPurpose purpose, int numberOfKeys); DeterministicKey freshReceiveKey(); Address freshAddress(KeyChain.KeyPurpose purpose); Address freshReceiveAddress(); List<ECKey> getIssuedReceiveKeys(); List<Address> getIssuedReceiveAddresses(); void upgradeToDeterministic(@Nullable KeyParameter aesKey); boolean isDeterministicUpgradeRequired(); List<Script> getWatchedScripts(); boolean removeKey(ECKey key); int getKeyChainGroupSize(); @VisibleForTesting int getKeyChainGroupCombinedKeyLookaheadEpochs(); List<ECKey> getImportedKeys(); Address currentChangeAddress(); Address getChangeAddress(); @Deprecated boolean addKey(ECKey key); boolean importKey(ECKey key); @Deprecated int addKeys(List<ECKey> keys); int importKeys(final List<ECKey> keys); int importKeysAndEncrypt(final List<ECKey> keys, CharSequence password); int importKeysAndEncrypt(final List<ECKey> keys, KeyParameter aesKey); void addAndActivateHDChain(DeterministicKeyChain chain); void setKeyChainGroupLookaheadSize(int lookaheadSize); int getKeyChainGroupLookaheadSize(); void setKeyChainGroupLookaheadThreshold(int num); int getKeyChainGroupLookaheadThreshold(); DeterministicKey getWatchingKey(); boolean isWatching(); boolean isAddressWatched(Address address); boolean addWatchedAddress(final Address address); boolean addWatchedAddress(final Address address, long creationTime); int addWatchedAddresses(final List<Address> addresses, long creationTime); int addWatchedScripts(final List<Script> scripts); boolean removeWatchedAddress(final Address address); boolean removeWatchedAddresses(final List<Address> addresses); boolean removeWatchedScripts(final List<Script> scripts); List<Address> getWatchedAddresses(); @Override @Nullable ECKey findKeyFromPubHash(byte[] pubkeyHash); boolean hasKey(ECKey key); @Override boolean isPubKeyHashMine(byte[] pubkeyHash); @Override boolean isWatchedScript(Script script); @Override @Nullable ECKey findKeyFromPubKey(byte[] pubkey); @Override boolean isPubKeyMine(byte[] pubkey); @Nullable @Override RedeemData findRedeemDataFromScriptHash(byte[] payToScriptHash); @Override boolean isPayToScriptHashMine(byte[] payToScriptHash); DeterministicSeed getKeyChainSeed(); DeterministicKey getKeyByPath(List<ChildNumber> path); void encrypt(CharSequence password); void encrypt(KeyCrypter keyCrypter, KeyParameter aesKey); void decrypt(CharSequence password); void decrypt(KeyParameter aesKey); boolean checkPassword(CharSequence password); boolean checkAESKey(KeyParameter aesKey); @Nullable KeyCrypter getKeyCrypter(); EncryptionType getEncryptionType(); boolean isEncrypted(); void changeEncryptionPassword(CharSequence currentPassword, CharSequence newPassword); void changeEncryptionKey(KeyCrypter keyCrypter, KeyParameter currentAesKey, KeyParameter newAesKey); List<Protos.Key> serializeKeyChainGroupToProtobuf(); void saveToFile(File temp, File destFile); void saveToFile(File f); void setAcceptRiskyTransactions(boolean acceptRiskyTransactions); boolean isAcceptRiskyTransactions(); void setRiskAnalyzer(RiskAnalysis.Analyzer analyzer); RiskAnalysis.Analyzer getRiskAnalyzer(); WalletFiles autosaveToFile(File f, long delayTime, TimeUnit timeUnit,
                                      @Nullable WalletFiles.Listener eventListener); void shutdownAutosaveAndWait(); void saveToFileStream(OutputStream f); NetworkParameters getParams(); Context getContext(); static Wallet loadFromFile(File file, @Nullable WalletExtension... walletExtensions); boolean isConsistent(); void isConsistentOrThrow(); static Wallet loadFromFileStream(InputStream stream, @Nullable WalletExtension... walletExtensions); @Override boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block,
                                              BlockChain.NewBlockType blockType,
                                              int relativityOffset); void receivePending(Transaction tx, @Nullable List<Transaction> dependencies, boolean overrideIsRelevant); void receiveLock(Transaction tx); boolean isTransactionRisky(Transaction tx, @Nullable List<Transaction> dependencies); void receivePending(Transaction tx, @Nullable List<Transaction> dependencies); boolean isPendingTransactionRelevant(Transaction tx); boolean isPendingTransactionLockRelevant(Transaction tx); boolean isTransactionRelevant(Transaction tx); @Override void receiveFromBlock(Transaction tx, StoredBlock block,
                                 BlockChain.NewBlockType blockType,
                                 int relativityOffset); @Override void notifyNewBestBlock(StoredBlock block); boolean maybeCommitTx(Transaction tx); void commitTx(Transaction tx); void addEventListener(WalletEventListener listener); @Deprecated void addEventListener(WalletEventListener listener, Executor executor); void addChangeEventListener(WalletChangeEventListener listener); void addChangeEventListener(Executor executor, WalletChangeEventListener listener); void addCoinsReceivedEventListener(WalletCoinsReceivedEventListener listener); void addCoinsReceivedEventListener(Executor executor, WalletCoinsReceivedEventListener listener); void addCoinsSentEventListener(WalletCoinsSentEventListener listener); void addCoinsSentEventListener(Executor executor, WalletCoinsSentEventListener listener); void addKeyChainEventListener(KeyChainEventListener listener); void addKeyChainEventListener(Executor executor, KeyChainEventListener listener); void addReorganizeEventListener(WalletReorganizeEventListener listener); void addReorganizeEventListener(Executor executor, WalletReorganizeEventListener listener); void addScriptsChangeEventListener(ScriptsChangeEventListener listener); void addScriptChangeEventListener(Executor executor, ScriptsChangeEventListener listener); void addTransactionConfidenceEventListener(TransactionConfidenceEventListener listener); void addTransactionConfidenceEventListener(Executor executor, TransactionConfidenceEventListener listener); @Deprecated boolean removeEventListener(WalletEventListener listener); boolean removeChangeEventListener(WalletChangeEventListener listener); boolean removeCoinsReceivedEventListener(WalletCoinsReceivedEventListener listener); boolean removeCoinsSentEventListener(WalletCoinsSentEventListener listener); boolean removeKeyChainEventListener(KeyChainEventListener listener); boolean removeReorganizeEventListener(WalletReorganizeEventListener listener); boolean removeScriptChangeEventListener(ScriptsChangeEventListener listener); boolean removeTransactionConfidenceEventListener(TransactionConfidenceEventListener listener); Set<Transaction> getTransactions(boolean includeDead); Iterable<WalletTransaction> getWalletTransactions(); void addWalletTransaction(WalletTransaction wtx); List<Transaction> getTransactionsByTime(); List<Transaction> getRecentTransactions(int numTransactions, boolean includeDead); @Nullable Transaction getTransaction(Sha256Hash hash); @Override Map<Sha256Hash, Transaction> getTransactionPool(Pool pool); void reset(); void clearTransactions(int fromHeight); List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbases); void cleanup(); @VisibleForTesting int getPoolSize(WalletTransaction.Pool pool); @VisibleForTesting boolean poolContainsTxHash(final WalletTransaction.Pool pool, final Sha256Hash txHash); List<TransactionOutput> getUnspents(); @Override String toString(); String toString(boolean includePrivateKeys, boolean includeTransactions, boolean includeExtensions,
                           @Nullable AbstractBlockChain chain); Collection<Transaction> getPendingTransactions(); @Override long getEarliestKeyCreationTime(); @Nullable Sha256Hash getLastBlockSeenHash(); void setLastBlockSeenHash(@Nullable Sha256Hash lastBlockSeenHash); void setLastBlockSeenHeight(int lastBlockSeenHeight); void setLastBlockSeenTimeSecs(long timeSecs); long getLastBlockSeenTimeSecs(); @Nullable Date getLastBlockSeenTime(); int getLastBlockSeenHeight(); int getVersion(); void setVersion(int version); void setDescription(String description); String getDescription(); @Deprecated Coin getWatchedBalance(); @Deprecated Coin getWatchedBalance(CoinSelector selector); Coin getBalance(); Coin getBalance(BalanceType balanceType); Coin getBalance(CoinSelector selector); ListenableFuture<Coin> getBalanceFuture(final Coin value, final BalanceType type); Coin getTotalReceived(); Coin getTotalSent(); Transaction createSend(Address address, Coin value); Transaction sendCoinsOffline(SendRequest request); SendResult sendCoins(TransactionBroadcaster broadcaster, Address to, Coin value); SendResult sendCoins(TransactionBroadcaster broadcaster, SendRequest request); SendResult sendCoins(SendRequest request); Transaction sendCoins(Peer peer, SendRequest request); void completeTx(SendRequest req); void signTransaction(SendRequest req); List<TransactionOutput> calculateAllSpendCandidates(); @Deprecated List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases); List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases, boolean excludeUnsignable); boolean canSignFor(Script script); CoinSelector getCoinSelector(); void setCoinSelector(CoinSelector coinSelector); void allowSpendingUnconfirmedTransactions(); @Nullable UTXOProvider getUTXOProvider(); void setUTXOProvider(@Nullable UTXOProvider provider); @Override void reorganize(StoredBlock splitPoint, List<StoredBlock> oldBlocks, List<StoredBlock> newBlocks); @Override void beginBloomFilterCalculation(); @Override @GuardedBy("keyChainGroupLock") void endBloomFilterCalculation(); @Override int getBloomFilterElementCount(); @Override boolean isRequiringUpdateAllBloomFilter(); BloomFilter getBloomFilter(double falsePositiveRate); @Override @GuardedBy("keyChainGroupLock") BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak); boolean checkForFilterExhaustion(FilteredBlock block); void addExtension(WalletExtension extension); WalletExtension addOrGetExistingExtension(WalletExtension extension); void addOrUpdateExtension(WalletExtension extension); Map<String, WalletExtension> getExtensions(); void deserializeExtension(WalletExtension extension, byte[] data); @Override void setTag(String tag, ByteString value); FeeCalculation calculateFee(SendRequest req, Coin value, List<TransactionInput> originalInputs,
                                       boolean needAtLeastReferenceFee, List<TransactionOutput> candidates); void setTransactionBroadcaster(@Nullable org.bitcoinj.core.TransactionBroadcaster broadcaster); void setKeyRotationTime(Date time); @Nullable Date getKeyRotationTime(); void setKeyRotationTime(long unixTimeSeconds); boolean isKeyRotating(ECKey key); @Deprecated ListenableFuture<List<Transaction>> maybeDoMaintenance(@Nullable KeyParameter aesKey, boolean andSend); ListenableFuture<List<Transaction>> doMaintenance(@Nullable KeyParameter aesKey, boolean signAndSend); boolean hasKeyChain(ImmutableList<ChildNumber> path); void addKeyChain(ImmutableList<ChildNumber> path); }
Wallet extends BaseTaggableObject implements NewBestBlockListener, TransactionReceivedInBlockListener, PeerFilterProvider, KeyBag, TransactionBag, ReorganizeListener { List<Transaction> sortTxnsByDependency(Set<Transaction> inputSet) { ArrayList<Transaction> result = new ArrayList<Transaction>(inputSet); for (int i = 0; i < result.size()-1; i++) { boolean txAtISpendsOtherTxInTheList; do { txAtISpendsOtherTxInTheList = false; for (int j = i+1; j < result.size(); j++) { if (spends(result.get(i), result.get(j))) { Transaction transactionAtI = result.remove(i); result.add(j, transactionAtI); txAtISpendsOtherTxInTheList = true; break; } } } while (txAtISpendsOtherTxInTheList); } return result; } Wallet(NetworkParameters params);  Wallet(Context context);  Wallet(NetworkParameters params, KeyChainGroup keyChainGroup); private  Wallet(Context context, KeyChainGroup keyChainGroup); static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed); static Wallet fromSeed(NetworkParameters params, DeterministicSeed seed, ImmutableList<ChildNumber> accountPath); static Wallet fromWatchingKey(NetworkParameters params, DeterministicKey watchKey); static Wallet fromWatchingKeyB58(NetworkParameters params, String watchKeyB58, long creationTimeSeconds); static Wallet fromKeys(NetworkParameters params, List<ECKey> keys); NetworkParameters getNetworkParameters(); DeterministicKeyChain getActiveKeyChain(); final void addTransactionSigner(TransactionSigner signer); List<TransactionSigner> getTransactionSigners(); DeterministicKey currentKey(KeyChain.KeyPurpose purpose); DeterministicKey currentReceiveKey(); Address currentAddress(KeyChain.KeyPurpose purpose); Address currentReceiveAddress(); DeterministicKey freshKey(KeyChain.KeyPurpose purpose); List<DeterministicKey> freshKeys(KeyChain.KeyPurpose purpose, int numberOfKeys); DeterministicKey freshReceiveKey(); Address freshAddress(KeyChain.KeyPurpose purpose); Address freshReceiveAddress(); List<ECKey> getIssuedReceiveKeys(); List<Address> getIssuedReceiveAddresses(); void upgradeToDeterministic(@Nullable KeyParameter aesKey); boolean isDeterministicUpgradeRequired(); List<Script> getWatchedScripts(); boolean removeKey(ECKey key); int getKeyChainGroupSize(); @VisibleForTesting int getKeyChainGroupCombinedKeyLookaheadEpochs(); List<ECKey> getImportedKeys(); Address currentChangeAddress(); Address getChangeAddress(); @Deprecated boolean addKey(ECKey key); boolean importKey(ECKey key); @Deprecated int addKeys(List<ECKey> keys); int importKeys(final List<ECKey> keys); int importKeysAndEncrypt(final List<ECKey> keys, CharSequence password); int importKeysAndEncrypt(final List<ECKey> keys, KeyParameter aesKey); void addAndActivateHDChain(DeterministicKeyChain chain); void setKeyChainGroupLookaheadSize(int lookaheadSize); int getKeyChainGroupLookaheadSize(); void setKeyChainGroupLookaheadThreshold(int num); int getKeyChainGroupLookaheadThreshold(); DeterministicKey getWatchingKey(); boolean isWatching(); boolean isAddressWatched(Address address); boolean addWatchedAddress(final Address address); boolean addWatchedAddress(final Address address, long creationTime); int addWatchedAddresses(final List<Address> addresses, long creationTime); int addWatchedScripts(final List<Script> scripts); boolean removeWatchedAddress(final Address address); boolean removeWatchedAddresses(final List<Address> addresses); boolean removeWatchedScripts(final List<Script> scripts); List<Address> getWatchedAddresses(); @Override @Nullable ECKey findKeyFromPubHash(byte[] pubkeyHash); boolean hasKey(ECKey key); @Override boolean isPubKeyHashMine(byte[] pubkeyHash); @Override boolean isWatchedScript(Script script); @Override @Nullable ECKey findKeyFromPubKey(byte[] pubkey); @Override boolean isPubKeyMine(byte[] pubkey); @Nullable @Override RedeemData findRedeemDataFromScriptHash(byte[] payToScriptHash); @Override boolean isPayToScriptHashMine(byte[] payToScriptHash); DeterministicSeed getKeyChainSeed(); DeterministicKey getKeyByPath(List<ChildNumber> path); void encrypt(CharSequence password); void encrypt(KeyCrypter keyCrypter, KeyParameter aesKey); void decrypt(CharSequence password); void decrypt(KeyParameter aesKey); boolean checkPassword(CharSequence password); boolean checkAESKey(KeyParameter aesKey); @Nullable KeyCrypter getKeyCrypter(); EncryptionType getEncryptionType(); boolean isEncrypted(); void changeEncryptionPassword(CharSequence currentPassword, CharSequence newPassword); void changeEncryptionKey(KeyCrypter keyCrypter, KeyParameter currentAesKey, KeyParameter newAesKey); List<Protos.Key> serializeKeyChainGroupToProtobuf(); void saveToFile(File temp, File destFile); void saveToFile(File f); void setAcceptRiskyTransactions(boolean acceptRiskyTransactions); boolean isAcceptRiskyTransactions(); void setRiskAnalyzer(RiskAnalysis.Analyzer analyzer); RiskAnalysis.Analyzer getRiskAnalyzer(); WalletFiles autosaveToFile(File f, long delayTime, TimeUnit timeUnit,
                                      @Nullable WalletFiles.Listener eventListener); void shutdownAutosaveAndWait(); void saveToFileStream(OutputStream f); NetworkParameters getParams(); Context getContext(); static Wallet loadFromFile(File file, @Nullable WalletExtension... walletExtensions); boolean isConsistent(); void isConsistentOrThrow(); static Wallet loadFromFileStream(InputStream stream, @Nullable WalletExtension... walletExtensions); @Override boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block,
                                              BlockChain.NewBlockType blockType,
                                              int relativityOffset); void receivePending(Transaction tx, @Nullable List<Transaction> dependencies, boolean overrideIsRelevant); void receiveLock(Transaction tx); boolean isTransactionRisky(Transaction tx, @Nullable List<Transaction> dependencies); void receivePending(Transaction tx, @Nullable List<Transaction> dependencies); boolean isPendingTransactionRelevant(Transaction tx); boolean isPendingTransactionLockRelevant(Transaction tx); boolean isTransactionRelevant(Transaction tx); @Override void receiveFromBlock(Transaction tx, StoredBlock block,
                                 BlockChain.NewBlockType blockType,
                                 int relativityOffset); @Override void notifyNewBestBlock(StoredBlock block); boolean maybeCommitTx(Transaction tx); void commitTx(Transaction tx); void addEventListener(WalletEventListener listener); @Deprecated void addEventListener(WalletEventListener listener, Executor executor); void addChangeEventListener(WalletChangeEventListener listener); void addChangeEventListener(Executor executor, WalletChangeEventListener listener); void addCoinsReceivedEventListener(WalletCoinsReceivedEventListener listener); void addCoinsReceivedEventListener(Executor executor, WalletCoinsReceivedEventListener listener); void addCoinsSentEventListener(WalletCoinsSentEventListener listener); void addCoinsSentEventListener(Executor executor, WalletCoinsSentEventListener listener); void addKeyChainEventListener(KeyChainEventListener listener); void addKeyChainEventListener(Executor executor, KeyChainEventListener listener); void addReorganizeEventListener(WalletReorganizeEventListener listener); void addReorganizeEventListener(Executor executor, WalletReorganizeEventListener listener); void addScriptsChangeEventListener(ScriptsChangeEventListener listener); void addScriptChangeEventListener(Executor executor, ScriptsChangeEventListener listener); void addTransactionConfidenceEventListener(TransactionConfidenceEventListener listener); void addTransactionConfidenceEventListener(Executor executor, TransactionConfidenceEventListener listener); @Deprecated boolean removeEventListener(WalletEventListener listener); boolean removeChangeEventListener(WalletChangeEventListener listener); boolean removeCoinsReceivedEventListener(WalletCoinsReceivedEventListener listener); boolean removeCoinsSentEventListener(WalletCoinsSentEventListener listener); boolean removeKeyChainEventListener(KeyChainEventListener listener); boolean removeReorganizeEventListener(WalletReorganizeEventListener listener); boolean removeScriptChangeEventListener(ScriptsChangeEventListener listener); boolean removeTransactionConfidenceEventListener(TransactionConfidenceEventListener listener); Set<Transaction> getTransactions(boolean includeDead); Iterable<WalletTransaction> getWalletTransactions(); void addWalletTransaction(WalletTransaction wtx); List<Transaction> getTransactionsByTime(); List<Transaction> getRecentTransactions(int numTransactions, boolean includeDead); @Nullable Transaction getTransaction(Sha256Hash hash); @Override Map<Sha256Hash, Transaction> getTransactionPool(Pool pool); void reset(); void clearTransactions(int fromHeight); List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbases); void cleanup(); @VisibleForTesting int getPoolSize(WalletTransaction.Pool pool); @VisibleForTesting boolean poolContainsTxHash(final WalletTransaction.Pool pool, final Sha256Hash txHash); List<TransactionOutput> getUnspents(); @Override String toString(); String toString(boolean includePrivateKeys, boolean includeTransactions, boolean includeExtensions,
                           @Nullable AbstractBlockChain chain); Collection<Transaction> getPendingTransactions(); @Override long getEarliestKeyCreationTime(); @Nullable Sha256Hash getLastBlockSeenHash(); void setLastBlockSeenHash(@Nullable Sha256Hash lastBlockSeenHash); void setLastBlockSeenHeight(int lastBlockSeenHeight); void setLastBlockSeenTimeSecs(long timeSecs); long getLastBlockSeenTimeSecs(); @Nullable Date getLastBlockSeenTime(); int getLastBlockSeenHeight(); int getVersion(); void setVersion(int version); void setDescription(String description); String getDescription(); @Deprecated Coin getWatchedBalance(); @Deprecated Coin getWatchedBalance(CoinSelector selector); Coin getBalance(); Coin getBalance(BalanceType balanceType); Coin getBalance(CoinSelector selector); ListenableFuture<Coin> getBalanceFuture(final Coin value, final BalanceType type); Coin getTotalReceived(); Coin getTotalSent(); Transaction createSend(Address address, Coin value); Transaction sendCoinsOffline(SendRequest request); SendResult sendCoins(TransactionBroadcaster broadcaster, Address to, Coin value); SendResult sendCoins(TransactionBroadcaster broadcaster, SendRequest request); SendResult sendCoins(SendRequest request); Transaction sendCoins(Peer peer, SendRequest request); void completeTx(SendRequest req); void signTransaction(SendRequest req); List<TransactionOutput> calculateAllSpendCandidates(); @Deprecated List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases); List<TransactionOutput> calculateAllSpendCandidates(boolean excludeImmatureCoinbases, boolean excludeUnsignable); boolean canSignFor(Script script); CoinSelector getCoinSelector(); void setCoinSelector(CoinSelector coinSelector); void allowSpendingUnconfirmedTransactions(); @Nullable UTXOProvider getUTXOProvider(); void setUTXOProvider(@Nullable UTXOProvider provider); @Override void reorganize(StoredBlock splitPoint, List<StoredBlock> oldBlocks, List<StoredBlock> newBlocks); @Override void beginBloomFilterCalculation(); @Override @GuardedBy("keyChainGroupLock") void endBloomFilterCalculation(); @Override int getBloomFilterElementCount(); @Override boolean isRequiringUpdateAllBloomFilter(); BloomFilter getBloomFilter(double falsePositiveRate); @Override @GuardedBy("keyChainGroupLock") BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak); boolean checkForFilterExhaustion(FilteredBlock block); void addExtension(WalletExtension extension); WalletExtension addOrGetExistingExtension(WalletExtension extension); void addOrUpdateExtension(WalletExtension extension); Map<String, WalletExtension> getExtensions(); void deserializeExtension(WalletExtension extension, byte[] data); @Override void setTag(String tag, ByteString value); FeeCalculation calculateFee(SendRequest req, Coin value, List<TransactionInput> originalInputs,
                                       boolean needAtLeastReferenceFee, List<TransactionOutput> candidates); void setTransactionBroadcaster(@Nullable org.bitcoinj.core.TransactionBroadcaster broadcaster); void setKeyRotationTime(Date time); @Nullable Date getKeyRotationTime(); void setKeyRotationTime(long unixTimeSeconds); boolean isKeyRotating(ECKey key); @Deprecated ListenableFuture<List<Transaction>> maybeDoMaintenance(@Nullable KeyParameter aesKey, boolean andSend); ListenableFuture<List<Transaction>> doMaintenance(@Nullable KeyParameter aesKey, boolean signAndSend); boolean hasKeyChain(ImmutableList<ChildNumber> path); void addKeyChain(ImmutableList<ChildNumber> path);  }