anchor.diff:      Blocks =
           lists:foldl(
             fun(Hash, Acc) ->
  -                  fetch_block(Hash, Uri, Acc)
  +                  fetch_block(Hash, Uri) ++ Acc
             end, [], Hashes),
       try_write_blocks(Blocks).
   
  
positive.code: 
  do_start_sync(Uri) ->
      aec_events:publish(chain_sync, {client_start, Uri}),
      fetch_headers(Uri, genesis_hash()).
  
  do_server_get_missing(Uri) ->
      aec_events:publish(chain_sync, {server_start, Uri}),
      do_get_missing_blocks(Uri),
      aec_events:publish(chain_sync, {server_done, Uri}).
  
  genesis_hash() ->
      aec_conductor:genesis_hash().
  
  
  fetch_headers(Uri, GHash) ->
      case aeu_requests:top(Uri) of
          {ok, Hdr} ->
              lager:debug("Top hdr (~p): ~p", [Uri, pp(Hdr)]),
              {ok, HdrHash} = aec_headers:hash_header(Hdr),
              case HdrHash of
                  GHash ->
                      %% already the genesis hash
                      ok;
                  _ ->
                      fetch_headers_1(HdrHash, Hdr, Uri, GHash, [])
              end;
          {error, Reason} ->
              lager:debug("fetching top block (~p) failed: ~p", [Uri, Reason])
      end.
  
  fetch_headers_1(HdrHash, Hdr, Uri, GHash, Acc) ->
      {ResTag, _} = aec_conductor:get_header_by_hash(HdrHash),
      case ((ResTag =:= ok)
            andalso aec_conductor:hash_is_connected_to_genesis(HdrHash)) of
          true ->
              %% we have a continuous header chain
              headers_fetched(Uri, Acc);
          false ->
              lager:debug("we don't have the top block header,"
                          " fetching block (~p)", [pp(HdrHash)]),
              Acc1 = fetch_block(HdrHash, Uri, Acc),
              fetch_next_hdr(aec_headers:prev_hash(Hdr), Uri, GHash, Acc1)
      end.
  
  fetch_block(Hash, Uri, Acc) ->
      case do_fetch_block(Hash, Uri) of
          {ok, Block} ->
              lager:debug("Block (~p|~p) fetched", [Uri, pp(Hash)]),
              [{Hash, Block}|Acc];
          {error,_} = Err ->
              %% What is the right course of action here? Continue? Abort?
              lager:error("Error fetching block (~p|~p): ~p",
                          [Uri, Hash, Err]),
              Acc
      end.
  
  do_fetch_block(Hash, Uri) ->
      case aeu_requests:get_block(Uri, Hash) of
          {ok, Block} ->
              case header_hash(Block) =:= Hash of
                  true ->
                      lager:debug("block fetched from ~p (~p); ~p",
                                  [Uri, pp(Hash), pp(Block)]),
                      {ok, Block};
                  false ->
                      {error, hash_mismatch}
              end;
  
negative.code:             Error
      end.
  
  do_get_missing_blocks(Uri) ->
      Missing = aec_conductor:get_missing_block_hashes(),
      lager:debug("Missing block hashes: ~p", [pp(Missing)]),
  