Previously this function would not switch to a different chain if the current chain contained the preferred block. This was not the intended behaviour: if there is a *stronger* chain that *also* contains the preferred block, we should jump to that. Note that with this commit there will now always be a preferred block (defaults to genesis). Previously, it might seem that often there was none, but actually in practice if the user used the GUI context menu to switch servers even once, there was one (usually genesis). Hence, with the old code, if an attacker mined a single header which then got reorged, auto_connect clients which were connected to the attacker's server would never switch servers (jump chains) even without the user explicitly configuring preference for the stale branch.
27 KiB
27 KiB