anchor.diff:              LocalHeight = aec_headers:height(LocalHeader),
               MinAgreedHash = aec_chain:genesis_hash(),
               MaxAgree = min(LocalHeight, TopHeight),
  -            {AHeight, AHash} =
  -                agree_on_height(PeerId, TopHash, TopHeight,
  -                                MaxAgree, MaxAgree, ?GENESIS_HEIGHT, MinAgreedHash),
  -            lager:debug("Agreed upon height (~p): ~p", [ppp(PeerId), AHeight]),
  -            do_work_on_sync_task(PeerId, Task, {agreed_height, #{ height => AHeight, hash => AHash }});
  +            case  agree_on_height(PeerId, TopHash, TopHeight,
  +                                  MaxAgree, MaxAgree, ?GENESIS_HEIGHT, MinAgreedHash) of
  +                {ok, AHeight, AHash} ->
  +                    lager:debug("Agreed upon height (~p): ~p", [ppp(PeerId), AHeight]),
  +                    Agreement = {agreed_height, #{ height => AHeight, hash => AHash }},
  +                    do_work_on_sync_task(PeerId, Task, Agreement);
  +                {error, Reason} ->
  +                    do_work_on_sync_task(PeerId, Task, {error, {agree_on_height, Reason}})
  +            end;
           {fill_pool, StartFrom} ->
               fill_pool(PeerId, StartFrom, Task);
           {post_blocks, Blocks} ->
  
positive.code:     {lists:reverse(Acc), []};
  split_pool([X | Pool], Acc) ->
      split_pool(Pool, [X | Acc]).
  
  get_next_work_item(ST = #sync_task{ adding = [], pending = [ToAdd | NewPending] }) ->
      {{post_blocks, ToAdd}, ST#sync_task{ adding = ToAdd, pending = NewPending }};
  
negative.code:                  true ->
                       agree_on_height(PeerId, RHash, RH, Middle, RH, Min, AgreedHash);
                   false ->
                       {ok, Min, AgreedHash}
               end
      end;
  agree_on_height(PeerId, _, RH, CheckHeight, Max, Min, AgreedHash) when RH =/= CheckHeight ->
  