anchor.diff:  resolve_leaves(Nodes, Dest, SID, OwnerL) ->
       resolve_leaves(Nodes, Dest, SID, OwnerL, intervals:empty(), 0).
   
  -% @doc Returns number of caused resolve requests (requests with feedback count 2).
  +%% @doc Helper for resolve_leaves/4.
   -spec resolve_leaves([merkle_tree:mt_node()], Dest::comm:mypid(),
                        rrepair:session_id(), OwnerLocal::comm:erl_local_pid(),
                        Interval::intervals:interval(), Items::non_neg_integer())
           -> 0..2.
   resolve_leaves([Node | Rest], Dest, SID, OwnerL, Interval, Items) ->
  +    ?ASSERT(merkle_tree:is_leaf(Node)),
       LeafInterval = merkle_tree:get_interval(Node),
       IntervalNew = intervals:union(Interval, LeafInterval),
       ItemsNew = Items + merkle_tree:get_item_count(Node),
  
positive.code: p_check_node([], [], AccR, AccN, AccRes) ->
      {lists:reverse(AccR), lists:append(lists:reverse(AccN)), AccRes};
  p_check_node([{ToOmit, Hash} | TK], [Node | TN], AccR, AccN, AccRes) ->
      OmitNodes = [Node | lists:sublist(TN, 1, ToOmit - 1)],
      ToResolve = merkle_get_sync_leaves(OmitNodes, Hash, []),
      p_check_node(TK, lists:nthtail(ToOmit - 1, TN), AccR, AccN,
                   lists:append(ToResolve, AccRes));
  p_check_node([Hash | TK], [Node | TN], AccR, AccN, AccRes) ->
      IsLeaf = merkle_tree:is_leaf(Node),
      NodeHash = merkle_tree:get_hash(Node),
      case NodeHash =:= Hash of
          true when IsLeaf ->
              p_check_node(TK, TN, [?ok_leaf | AccR], AccN, AccRes);
          true when not IsLeaf ->
              p_check_node(TK, TN, [?ok_inner | AccR], AccN, AccRes);
          false when IsLeaf ->
              p_check_node(TK, TN, [{?fail_leaf, NodeHash} | AccR], AccN, AccRes);
          false when not IsLeaf ->
              Childs = merkle_tree:get_childs(Node),
              p_check_node(TK, TN, [?fail_inner | AccR], [Childs | AccN], AccRes)
      end.
  
  -spec process_tree_cmp_result([merkle_cmp_result()],
                                merkle_tree:merkle_tree() | RestTree,
                                BranchSize::pos_integer(), Stats)
  
negative.code:                 end,
      p_process_tree_cmp_result(CmpResult, TreeNodes, BranchSize, NStats, [], [], []).
  
  %% @doc Helper for process_tree_cmp_result/4.
  -spec p_process_tree_cmp_result([merkle_cmp_result()], RestTree, BranchSize,
                                  Stats, Acc::Req, Acc::Res, AccRTree::Res)
          -> {Req, Res, Stats, RestTree::Res}
  