Bitcoin Core HD Wallet v0.13.2 missing confirmed incoming transaction I made a transaction from my android wallet to my bitcoin core HD wallet (v0.13.2). At the time of writing, the transaction has 5 confirmations, both according to the android wallet and blockchain.info. However, my bitcoin core wallet fails to pick up the transaction, despite showing the right blockchain height.

The recipient address was generated by bitcoin-qt, hence it does belong to my HD wallet. Furthemore, I am able to sign a message with this address on bitcoin-qt (indicating I own the private key) and successfully verify the signature. In fact, in the course of my investigation, I had the unpleasant surprise of realizing that this address had already been generated in the past and I had already sent bitcoin to it as can be seen here. (This seems related to the issue reported in this post but is no longer the most pressing matter now). The older transaction using this address is part of my bitcoin-qt transaction log. So there can be no doubt the recipient address does belong to my bitcoin core HD wallet.

I am reluctant to attempt replicating the issue I have just described with another trial transaction. However, as this is probably relevant, I will explain what I did prior to this happening: 1. I made a copy of wallet.dat and removed the file from ~/.bitcoin (so running bitcoind or bitcoin-qt would automatically generate a new emptywallet.dat). 2. prior to the transaction I restored my copy of wallet.dat into ~/.bitcoin and started bitcoin-qt. 3. I asked bitcoin-qt for a new address and had my android wallet carry out the transaction. 4. I then shredded and removed wallet.dat and restarted bitcoind for a while. 5. When seeing the transaction had been confirmed, I re-instated my copy of wallet.dat into ~/.bitcoin with the intention of performing another transaction. 6. I then re-started bitcoin-qt which fails to pick up the latest transaction. 

Note that this process of mine of shredding wallet.dat from ~/.bitcoin (while a copy of the file exists in a more secure location) is something I have just decided to do, as a way of making it harder for any potential hacker to spend the coins on this wallet. 

So my bitcoin core wallet is obviously confused. Is there anything I can do to set it straight?  

EDIT: When I re-instated my wallet.datinto ~/.bitcoin I am guessing a re-scan was not triggered for some reason. I shredded again my current wallet.dat and re-instated my (older) backup: this time a re-scan was triggered and the missing transaction was picked up. 

So this issue is resolved as far as I can see it (albeit with the unease of not knowing why).
Bitcoin Core currently has no internal function to recover a complete wallet. If the key is unknown (not generated yet), Bitcoin-Core will not detect transaction from to to that key/address. Also, the keypool size does not matter at this point, funds sent to a keypool key/address are not detected at the moment.

For now (Bitcoin Core &lt;= 0.14.0), if you restore a backup, make sure you generate plenty of addresses, loop through getnewaddress and ensure you generate 1000 (or more?) keys.

After you did this, restart Bitcoin Core (qt/d) with -rescan

Hopefully we can add some HD restore features for Core 0.15.