anchor.diff:  %% merkle tree sync messages
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
  -on({check_nodes, SenderPid, ToCheck}, State = #rr_recon_state{ struct = Tree }) ->    
  -    Result = [check_node(X, Tree) || X <- ToCheck], %afraid of parallel (util:par_map) which causes lots tree copies
  +on({check_nodes, SenderPid, ToCheck}, State = #rr_recon_state{ struct = Tree }) ->
  +    %not merkle_tree:is_merkle_tree(Tree) andalso
  +    %    ct:pal("Parter: ~p", [[{merkle_tree:get_hash(X), merkle_tree:get_interval(X)} || X <- Tree]]),
  +    {Result, RestTree} = check_node(ToCheck, Tree),
       comm:send(SenderPid, {check_nodes_response, Result}),
  -    State#rr_recon_state{ dest_recon_pid = SenderPid };
  +    State#rr_recon_state{ dest_recon_pid = SenderPid, struct = RestTree };
   
   on({check_nodes_response, CmpResults}, State =
          #rr_recon_state{ dest_recon_pid = DestReconPid,
  
positive.code: % Merkle Tree specific
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  -spec check_node({intervals:interval(), merkle_tree:mt_node_key()}, merkle_tree:merkle_tree()) -> merkle_cmp_result().
  check_node({I, Hash}, Tree) ->
      Node = merkle_tree:lookup(I, Tree),
      case Node of
          not_found -> {I, not_found};
          _ ->
              IsLeaf = merkle_tree:is_leaf(Node),
              case merkle_tree:get_hash(Node) =:= Hash of
                  true when IsLeaf -> {I, ok_leaf};
                  true when not IsLeaf -> {I, ok_inner};
                  false when IsLeaf -> {I, fail_leaf};
                  false when not IsLeaf ->
                      {I, fail_inner, [merkle_tree:get_hash(N) || N <- merkle_tree:get_childs(Node)]} 
              end
      end.
  
  -spec process_tree_cmp_result([merkle_cmp_result()], merkle_tree:merkle_tree(), Stats) ->
            {Requests, Resolve, New::Stats}
      when
        is_subtype(Stats,     rr_recon_stats:stats()),
        is_subtype(Requests,  [merkle_cmp_request()]),
        is_subtype(Resolve,   [merkle_tree:mt_node()]).
  process_tree_cmp_result(CmpResult, Tree, Stats) ->
      Compared = length(CmpResult),
      NStats = rr_recon_stats:inc([{tree_compareLeft, -Compared}, 
                                   {tree_nodesCompared, Compared}], Stats),
      process_tree_cmp_result(CmpResult, Tree, [], [], NStats).
  
  -spec process_tree_cmp_result([merkle_cmp_result()], Tree, AccR::Requests, AccRes::Resolve, Old::Stats) -> {NewR::Requests, NewRes::Resolve, New::Stats}
      when
          is_subtype(Tree,        merkle_tree:merkle_tree()),
          is_subtype(Resolve,     [merkle_tree:mt_node()]),
          is_subtype(Stats,       rr_recon_stats:stats()),
          is_subtype(Requests,    [merkle_cmp_request()]).
  process_tree_cmp_result([], _Tree, AccReq, AccRes, Stats) ->
      {AccReq, AccRes, Stats};
  process_tree_cmp_result([{_, not_found} | T], Tree, AccReq, AccRes, Stats) ->
      NStats = rr_recon_stats:inc([{error_count, 1}], Stats),
      process_tree_cmp_result(T, Tree, AccReq, AccRes, NStats);
  process_tree_cmp_result([{_, ok_leaf} | T], Tree, AccReq, AccRes, Stats) ->
      NStats = rr_recon_stats:inc([{tree_compareSkipped, 1}], Stats),
      process_tree_cmp_result(T, Tree, AccReq, AccRes, NStats);
  process_tree_cmp_result([{I, ok_inner} | T], Tree, AccReq, AccRes, Stats) ->
      Node = merkle_tree:lookup(I, Tree),
      NStats = rr_recon_stats:inc([{tree_compareSkipped, merkle_tree:size(Node)}], Stats),
      process_tree_cmp_result(T, Tree, AccReq, AccRes, NStats);
  process_tree_cmp_result([{I, fail_leaf} | T], Tree, AccReq, AccRes, Stats) ->
      Node = merkle_tree:lookup(I, Tree),
      process_tree_cmp_result(T, Tree, AccReq, [Node | AccRes], Stats);
  process_tree_cmp_result([{I, fail_inner, ChildHashs} | T], Tree, AccReq, AccRes, Stats) ->
      Node = merkle_tree:lookup(I, Tree),
      case merkle_tree:is_leaf(Node) of
          false -> 
              MyChilds = merkle_tree:get_childs(Node),
              {Matched, NotMatched} = compareNodes(MyChilds, ChildHashs, {[], []}),
              Skipped = lists:foldl(fun(MNode, Acc) -> 
                                            Acc + case merkle_tree:is_leaf(MNode) of
                                                      true -> 0;
                                                      false -> merkle_tree:size(MNode) - 1
                                                  end
                                    end, 0, Matched),
              NewReq = [{merkle_tree:get_interval(X), merkle_tree:get_hash(X)} || X <- NotMatched],
              NStats = rr_recon_stats:inc([{tree_compareLeft, length(NotMatched)},
                                            {tree_nodesCompared, length(Matched)},
                                            {tree_compareSkipped, Skipped}], Stats),
              process_tree_cmp_result(T, Tree, lists:append(NewReq, AccReq), AccRes, NStats);
          true -> 
              process_tree_cmp_result(T, Tree, AccReq, [Node | AccRes], Stats)
      end.
  
  -spec compareNodes(CompareNodes::NodeL, CmpKeyList, Acc::Result) -> Result when
      is_subtype(CmpKeyList,  [merkle_tree:mt_node_key()]),
      is_subtype(NodeL,       [merkle_tree:mt_node()]),
      is_subtype(Result,      {Matched::NodeL, NotMatched::NodeL}).
  compareNodes([], [], Acc) -> Acc;
  compareNodes([N | Nodes], [H | NodeHashs], {Matched, NotMatched}) ->
      case merkle_tree:get_hash(N) =:= H of
          true -> compareNodes(Nodes, NodeHashs, {[N|Matched], NotMatched});
          false -> compareNodes(Nodes, NodeHashs, {Matched, [N|NotMatched]})
      end.
  
  % @doc Starts one resolve process per leaf node in a given node
  
negative.code: -type struct() :: bloom_recon_struct() |
                    merkle_tree:merkle_tree() |
                    art:art() |                        
                    [internal_params()] |
                    {merkle_nl, [merkle_tree:mt_nodes()]}.
  -type recon_dest() :: ?RT:key() | random.
  
  -record(rr_recon_state,
  