syncthing/syncthing — pull request #907 by AudriusButkevicius (2014-10-24 22:28:58+00:00)
Title: Puller desperation mode

I thought that the `Fix` method should only remove the old hash and not add the new hash, because that particular blocks size might have changed.

For example if we had issues with the last block which was less than 128k (10k for sake of argument), we'd store the hash for that 10k in the blockmap, then the file suddenly would change (modify the 10k and grow a bit).

Now when someone would try to retrieve that 10k hash, they would read that particular 10k block, check the hash, it wouldn't match (as we modify that 10k), would rehash it, and store the new hash for the 10k in the block map.
Now the problem is that the 10k block is no longer a 10k block, and the call to `Fix` would store a hash for the new 10k which is actually now part of a bigger block...

I don't see that causing problems apart from decreasing the hash space.