We update the tiprev and in next if statement we check whether the branchcache
is valid or not. If the update of tiprev happens, then definitely
self.validfor() will return False because filteredhash is old now.
Let's update the filteredhash if we update the tiprev also. This prevents us
from entering the loop where we iter all the heads, and find the tiprev.