anchor.diff:  peer_info(#peer{ host = H, port = P, pubkey = PK }) ->
       #{ host => H, port => P, pubkey => PK }.
   
  -%% Creates a peer record from peer's information map.
  --spec peer(peer_info(), boolean())
  -    -> {ok, peer()} | {error, term()}.
  -peer(PeerInfo, IsTrusted) ->
  -    #{ host := Host } = PeerInfo,
  -    case inet:getaddr(to_list(Host), inet) of
  -        {error, _} = Error -> Error;
  -        {ok, Addr} -> {ok, peer(Addr, PeerInfo, IsTrusted)}
  -    end.
  -
   %% Creates a peer record from peer's information and resolved address.
   -spec peer(inet:ip_address(), peer_info(), boolean()) -> peer().
   peer(PeerAddr, PeerInfo, IsTrusted) ->
  
positive.code:             State#state{ hostnames = HostMap2 }
      end.
  
  %% Handles hostname resolution event.
  -spec on_resolve_hostname(reference(), string(), state()) -> state().
  on_resolve_hostname(Ref, Host, State) ->
      #state{ hostnames = HostMap } = State,
      case maps:find(Host, HostMap) of
          {ok, {Ref, RetryCount, PeerMap}} ->
              case inet:getaddr(Host, inet) of
                  {error, nxdomain} ->
                      epoch_sync:info("Failed to resolve hostname ~p", [Host]),
                      HostData = {undefined, RetryCount + 1, PeerMap},
                      HostMap2 = resolver_schedule(Host, HostData, HostMap),
                      State#state{ hostnames = HostMap2 };
                  {ok, Addr} ->
                      HostMap2 = maps:remove(Host, HostMap),
                      State2 = State#state{ hostnames = HostMap2 },
                      maps:fold(fun
                          (_, {undefined, PeerInfo, IsTrusted}, S) ->
                              Peer = peer(Addr, PeerInfo, IsTrusted),
                              on_add_peer(Addr, Peer, S);
                          (_, {SourceAddr, PeerInfo, IsTrusted}, S) ->
                              Peer = peer(Addr, PeerInfo, IsTrusted),
                              on_add_peer(SourceAddr, Peer, S)
                      end, State2, PeerMap)
              end;
          _ ->
              State
      end.
  
negative.code: add_trusted(PeerInfos) when is_list(PeerInfos) ->
      lists:foreach(fun(I) -> add_trusted(I) end, PeerInfos);
  add_trusted(PeerInfo) ->
      async_add_peer(undefined, PeerInfo, true).
  
  %% @doc Adds a normal peer or a list of normal peers.
  %% The IP address of the node that gave us this peer must be specified.
  