@Override protected void onPostExecute(Integer maxExtended) { // Restore default (might have been reduced ...) mLogger.info("setting bloom filter false positives to default"); mKit.peerGroup().setBloomFilterFalsePositiveRate(PeerGroup.DEFAULT_BLOOM_FILTER_FP_RATE); mWakeLock.release(); mLogger.info("wakelock released"); // Do we need another rescan? if (maxExtended > HDChain.maxSafeExtend()) { mLogger.info(String.format("rescan extended by %d, rescanning", maxExtended)); rescanBlockchain(HDAddress.EPOCH); } else { mLogger.info("synchronized"); setSyncState(SyncState.SYNCHRONIZED); } }
@Override public void onWalletChanged(Wallet wallet) { // Compute balances and transaction counts. Iterable<WalletTransaction> iwt = mKit.wallet().getWalletTransactions(); mHDWallet.applyAllTransactions(iwt); // Check to make sure we have sufficient margins. int maxExtended = mHDWallet.ensureMargins(mKit.wallet()); // Persist the new state. mHDWallet.persist(mApp); Intent intent = new Intent("wallet-state-changed"); mLBM.sendBroadcast(intent); if (maxExtended > HDChain.maxSafeExtend()) { mLogger.info(String.format("%d addresses added, rescanning", maxExtended)); rescanBlockchain(HDAddress.EPOCH); } }