anchor.diff:      end,
       Result.
   
  +handle_crash(Pid, State, Handler) ->
  +    RTMs = state_get_RTMs(State),
  +    NewRTMs = [ case get_rtmpid(RTM) of
  +                    X when unknown =:= X orelse {Pid} =:= X ->
  +                        I = get_nth(RTM),
  +                        Name = get_nth_rtm_name(I),
  +                        Key = get_rtmkey(RTM),
  +                        api_dht_raw:unreliable_lookup(
  +                          Key, {get_rtm, comm:this(), Key, Name}),
  +                        rtm_entry_new(Key, unknown, I, unknown);
  +                    _ -> RTM
  +                end
  +                || RTM <- RTMs ],
  +    
  +
  +    %% scan over all running transactions and delete this Pid
  +    %% if necessary, takeover the tx and try deciding with abort
  +    NewState = State,
  +%%     NewState = lists:foldl(
  +%%                  fun(X,StateIter) ->
  +%%                          case tx_state:is_tx_state(X) of
  +%%                              true ->
  +%%                                  ct:pal("propose yourself (~.0p/~.0p) for: ~.0p~n",
  +%%                                         [self(),
  +%%                                          pid_groups:group_and_name_of(self()),
  +%%                                          tx_state:get_tid(X)]),
  +%%                                  on({tx_tm_rtm_propose_yourself, tx_state:get_tid(X)}, StateIter);
  +%%                              false -> StateIter
  +%%                          end
  +%%                 end, State, pdb:tab2list(state_get_tablename(State))),
  +
  +    %% no longer use this RTM
  +    ValidRTMs = [ X || X <- NewRTMs, unknown =/= get_rtmpid(X) ],
  +    case length(ValidRTMs) < 3
  +        andalso tx_tm =:= state_get_role(NewState)
  +        andalso on =:= Handler of
  +        true ->
  +            comm:send_local(self(), {update_RTMs_on_init}),
  +            gen_component:change_handler(
  +              state_set_RTMs(NewState, NewRTMs),
  +              fun ?MODULE:on_init/2);
  +        false -> state_set_RTMs(NewState, NewRTMs)
  +    end.
  +
  +
  +
  +
  +
   
   %% @doc Checks whether config parameters for tx_tm_rtm exist and are
   %%      valid.
  
positive.code:         false ->
              on(Msg, State)
      end;
  
  on_init({crash, Pid, _Cookie}, State) ->
      on_init({crash, Pid}, State);
  on_init({crash, _Pid} = Msg, State) ->
      %% only in tx_tm
      on(Msg, State).
  
  %% functions for periodic RTM updates
  -spec rtm_update(rtms()) -> ok.
  rtm_update(RTMs) ->
      _ = [ begin
                Name = get_nth_rtm_name(get_nth(RTM)),
                Key = get_rtmkey(RTM),
                api_dht_raw:unreliable_lookup(Key, {get_rtm, comm:this(), Key, Name})
            end
            || RTM <- RTMs],
      msg_delay:send_local(config:read(tx_rtm_update_interval) div 1000,
                            self(), {update_RTMs}),
      ok.
  
  %% functions for tx processing
  
negative.code:     on({crash, Pid}, State);
  on({crash, Pid}, State) ->
      ?TRACE_RTM_MGMT("tx_tm_rtm:on({crash,...}) of Pid ~p~n", [Pid]),
      handle_crash(Pid, State, on);
  %% on({crash, _Pid, _Cookie},
  %%    {_RTMs, _TableName, _Role, _LAcceptor, _GLLearner} = State) ->
  %%     ?TRACE("tx_tm_rtm:on:crash of ~p in Transaction ~p~n", [_Pid, binary_to_term(_Cookie)]),
  