anchor.diff:                       [{_, KeyHashes2}] = key_hashes(T2, Segment),
                        KeyHashes2
                end,
  -    AccFun = fun(Keys, KeyAcc) ->
  +    AccFun = fun(Keys, KeyAcc, _Segment) ->
                        Keys ++ KeyAcc
                end,
       compare2(T1, Remote, AccFun, []).
  
positive.code:                         true
                      end)).
  
  -endif.
  
negative.code:         _ ->
              undefined
      end.
  
  -spec estimate_keys(hashtree()) -> {ok, integer()}.
  estimate_keys(State) ->
      estimate_keys(State, 0, 0, ?NUM_KEYS_REQUIRED).
  
  estimate_keys(_State, ?MAX_NUM_SEGMENTS, Keys, _MaxKeys) ->
      {ok, Keys*(?NUM_SEGMENTS div ?MAX_NUM_SEGMENTS)};
  
  estimate_keys(_State, CurrentSegment, Keys, MaxKeys) when Keys >= MaxKeys ->
      {ok, (Keys * ?NUM_SEGMENTS) div (CurrentSegment + 1)};
  
  estimate_keys(State, CurrentSegment, Keys, MaxKeys) ->
      [{_, KeyHashes2}] = key_hashes(State, CurrentSegment),
      estimate_keys(State, CurrentSegment + 1, Keys + length(KeyHashes2), MaxKeys).
  
  -spec key_hashes(hashtree(), integer()) -> [{integer(), orddict()}].
  key_hashes(State, Segment) ->
  