HD Wallets: add a threshold for the DeterministicKey lookahead

DeterministicKeyChain.maybeLookAhead() would pre-generate a new key, for
every issued key, even if it is only one. If we replay the blockchain
and update the issuedKeys counter, maybeLookAhead() would trigger the
regeneration and resending of the bloom filter for every used key.

This patch adds a threshold, where keys are only pre-generated after
more keys are needed than the value of the threshold.
HD Wallets: mark the DeterministicKeys as issued, if seen in a Transaction

If a Transaction contains a DeterministicKey of our
DeterministicKeyChains, then we should mark this key as issued. This can
happen, when we replay/resync the blockchain or when another device uses
one of our keys.