anchor.diff:      {ok, State}.
   
   %% -- Local functions --------------------------------------------------------
  +handle_general_error(S) ->
  +    S1 = cleanup_connection(S),
  +    case is_non_registered_accept(S) of
  +        true ->
  +            {stop, normal, S1};
  +        false ->
  +            connect_fail(S1)
  +    end.
  +
   get_request(S, Kind) ->
       maps:get(map_request(Kind), maps:get(requests, S, #{}), none).
   
   set_request(S, Kind, From) ->
       Rs = maps:get(requests, S, #{}),
  -    S#{ requests => Rs#{ Kind => {Kind, From} } }.
  +    TRef = erlang:start_timer(?REQUEST_TIMEOUT, self(), {request, Kind}),
  +    S#{ requests => Rs#{ Kind => {Kind, From, TRef} } }.
   
   remove_request_fld(S, Kind) ->
       Rs = maps:get(requests, S, #{}),
  +    case get_request(S, Kind) of
  +        none ->
  +            ok;
  +        {_MappedKind, _From, TRef} ->
  +            erlang:cancel_timer(TRef)
  +    end,
       S#{ requests => maps:remove(map_request(Kind), Rs) }.
  +
  +handle_request_timeout(S, Ref, Kind) ->
  +    case get_request(S, Kind) of
  +        {_MappedKind, From, Ref} ->
  +            lager:info("~p request timeout, stopping peer_connection", [Kind]),
  +            gen_server:reply(From, {error, request_timeout}),
  +            handle_general_error(S);
  +        _Other ->
  +            %% We got a stale timeout
  +            {noreply, S}
  +    end.
   
   map_request(mempool)              -> get_mempool;
   map_request(get_header_by_hash)   -> get_header;
  
positive.code: 
  cleanup_requests(State) ->
      Reqs = maps:to_list(maps:get(requests, State, #{})),
      [ gen_server:reply(From, {error, disconnected})
        || {_Request, From} <- Reqs ],
      maps:remove(requests, State).
  
  connect_fail(S0) ->
  
negative.code:     send_response(S, mempool, {ok, #{ txs => Txs }}),
      S.
  
  handle_get_mempool_rsp(S, {get_mempool, From, _TRef}, MsgObj) ->
      case maps:get(txs, MsgObj, undefined) of
          Txs0 when is_list(Txs0) ->
              Txs = [ aetx_sign:deserialize_from_binary(T) || T <- Txs0 ],
  