It can now handle small reorgs without having to rescan the whole blockchain. Also add a test for it.