anchor.diff:      send_heartbeat_with_peers(ns_node_disco:nodes_wanted(), master, StateData1#state.peers),
       {next_state, master, StateData1};
   
  -handle_info(send_heartbeat, worker, StateData) ->
  -    misc:flush(send_heartbeat),
  -    %% Workers don't send heartbeats, but it's simpler to just ignore
  -    %% the timer than to turn it off.
  -    {next_state, worker, StateData};
  -
   handle_info({peers, Peers}, master, StateData) ->
       S = update_peers(StateData, Peers),
       case lists:member(node(), Peers) of
  
positive.code:                  [Event, State]),
      {next_state, master, State}.
  
  
  worker({heartbeat, NodeInfo, master, _H}, State) ->
      Node = node_info_to_node(NodeInfo),
  
      Now = time_compat:monotonic_time(),
      case State#state.master of
          Node ->
              {next_state, worker, State#state{last_heard=Now}};
          N ->
              ?log_info("Saw master change from ~p to ~p", [N, Node]),
              {next_state, worker, State#state{last_heard=Now, master=Node}}
      end;
  
  worker(Event, State) ->
      ?log_warning("Got unextected event ~p as worker with state ~p",
                   [Event, State]),
      {next_state, worker, State}.
  
  
  %%
  %% Internal functions
  %%
  
negative.code:         false ->
              ?log_info("Master has been demoted. Peers = ~p", [Peers]),
              NewState = shutdown_master_sup(S),
              {next_state, candidate, NewState}
      end;
  
  handle_info({peers, Peers}, candidate, StateData) ->
      S = update_peers(StateData, Peers),
      case Peers of
          [N] when N == node() ->
              ale:info(?USER_LOGGER, "I'm now the only node, so I'm the master.", []),
              {next_state, master, start_master(S)};
          _ ->
              {next_state, candidate, S}
      end;
  
  handle_info(Info, StateName, StateData) ->
  