anchor.diff:  %% @private
   %% @doc Send an heartbeat to a list of nodes, except this one.
   send_heartbeat(Nodes, StateName, StateData) ->
  -    Args = {heartbeat, node(), StateName,
  -            [{peers, StateData#state.peers}]},
  +    NodeInfo = node_info(StateData),
  +
  +    Args = {heartbeat, NodeInfo, StateName,
  +            [{peers, StateData#state.peers},
  +             {versioning, true}]},
       try
           misc:parallel_map(
             fun (Node) ->
  
positive.code: %% States
  %%
  
  candidate({heartbeat, Node, master, _H}, #state{peers=Peers} = State) ->
      case State#state.master of
          Node ->
              {next_state, candidate, State#state{last_heard=now()}};
          N ->
              case lists:member(Node, Peers) of
                  true ->
                      ?log_info("Changing master from ~p to ~p", [N, Node]),
                      {next_state, candidate, State#state{last_heard=now(),
                                                          master=Node}};
                  false ->
                      ?log_warning("Master got master heartbeat from node ~p "
                                   "which is not in peers ~p", [Node, Peers]),
                      {next_state, candidate, State}
              end
      end;
  
  candidate({heartbeat, Node, candidate, _H}, #state{peers=Peers} = State) ->
      case lists:member(Node, Peers) of
          true ->
              case Node < node() of
                  true ->
                      %% Higher priority node
                      {next_state, candidate, State#state{last_heard=now()}};
                  false ->
                      %% Lower priority, so ignore it
                      {next_state, candidate, State}
              end;
          false ->
              ?log_warning("Candidate got candidate heartbeat from node ~p which "
                           "is not in peers ~p", [Node, Peers]),
              {next_state, candidate, State}
      end;
  
  candidate(Event, State) ->
  
negative.code: -behaviour(gen_fsm).
  
  -include("ns_common.hrl").
  -include_lib("eunit/include/eunit.hrl").
  
  %% Constants and definitions
  -define(HEARTBEAT_INTERVAL, 2000).
  -define(TIMEOUT, ?HEARTBEAT_INTERVAL * 5000). % in microseconds
  
  -type node_info() :: node() | {version(), node()}.
  -type operation_mode() :: compatible | normal.
  
  -define(DEFAULT_MODE, compatible).
  
  -record(state, {child                :: pid(),
                  master               :: node(),
                  peers                :: [node()],
                  last_heard           :: {integer(), integer(), integer()},
  
                  new_peers            :: [node()],
                  mode = ?DEFAULT_MODE :: operation_mode()}).
  
  
  %% API
  