/** * Pre-generate enough keys to reach the lookahead size. You can call this if you need to * explicitly invoke the lookahead procedure, but it's normally unnecessary as it will be done * automatically when needed. */ public void maybeLookAhead() { lock.lock(); try { List<DeterministicKey> keys = maybeLookAhead(externalKey, issuedExternalKeys); keys.addAll(maybeLookAhead(internalKey, issuedInternalKeys)); // Batch add all keys at once so there's only one event listener invocation, as this will be // listened to // by the wallet and used to rebuild/broadcast the Bloom filter. That's expensive so we don't // want to do // it more often than necessary. basicKeyChain.importKeys(keys); } finally { lock.unlock(); } }