anchor.diff:                                  LocalItem
                           end,
                 NewItem = tx_item_state:set_status(TmpItem, ok),
  -              _ = my_set_entry(NewItem, State),
  +              _ = my_set_entry(NewItem, NewState),
                 NewItem
             end || Entry <- ItemStates],
   
       %% initiate local paxos acceptors (with received paxos_ids)
       Learners = tx_state:get_learners(TxState),
  -    LAcceptor = state_get_lacceptor(State),
  +    LAcceptor = state_get_lacceptor(NewState),
       _ = [ [ acceptor:start_paxosid_local(LAcceptor, PaxId, Learners)
           || {PaxId, _RTlog, _TP}
                  <- tx_item_state:get_paxosids_rtlogs_tps(ItemState) ]
  
positive.code:     %% lookup transaction id locally and merge with given TxState
      Tid = tx_state:get_tid(TxState),
      {LocalTxStatus, LocalTxEntry} = my_get_tx_entry(Tid, State),
      TmpEntry = case LocalTxStatus of
                     new ->
                         %% TODO: instead subscribing directly do a
                         %% reference counting in the status field
                         %% state_get_subs / state_set_subs
                         fd:subscribe(tx_state:get_tm(TxState)),
                         TxState; %% nothing known locally
                     uninitialized ->
                         %% take over hold back from existing entry
                         %%io:format("initRTM takes over hold back queue for id ~p in ~p~n", [Tid, Role]),
                         HoldBackQ = tx_state:get_hold_back(LocalTxEntry),
                         tx_state:set_hold_back(TxState, HoldBackQ);
                     ok ->
                         log:log(error, "Duplicate init_RTM", []),
                         LocalTxEntry
                 end,
      NewEntry = tx_state:set_status(TmpEntry, ok),
      _ = my_set_entry(NewEntry, State),
  
      %% lookup items locally and merge with given ItemStates
      NewItemStates =
          [ begin
                EntryId = tx_item_state:get_itemid(Entry),
                {LocalItemStatus, LocalItem} = my_get_item_entry(EntryId, State),
                TmpItem = case LocalItemStatus of
                              new -> Entry; %% nothing known locally
                              uninitialized ->
  
negative.code: state_to_on(State) ->
      {A, B, C, D, E, F, _G} = State,
      {A, B, C, D, E, F}.
  
  -spec state_subscribe(state(), comm:mypid()) -> state().
  state_subscribe(State, Pid) ->
      Subs = state_get_subs(State),
      NewSubs = case lists:keyfind(Pid, 1, Subs) of
                    false -> fd:subscribe(Pid),
                             [{Pid, 1} | Subs];
                    Tuple ->
                        NewVal = setelement(2, Tuple, element(2, Tuple) + 1),
                        lists:keyreplace(Pid, 1, Subs, NewVal)
                end,
      state_set_subs(State, NewSubs).
  
  -spec state_unsubscribe(state(), comm:mypid()) -> state().
  state_unsubscribe(State, Pid) ->
      Subs = state_get_subs(State),
      NewSubs = case lists:keyfind(Pid, 1, Subs) of
                    false -> Subs;
                    Tuple ->
                        case element(2, Tuple) of
                            1 ->
                                %% delay the actual unsubscribe for better perf.?
                                fd:unsubscribe(element(1, Tuple)),
                                lists:keydelete(Pid, 1, Subs);
                            Num ->
                                NewVal = setelement(2, Tuple, Num - 1),
                                lists:keyreplace(Pid, 1, Subs, NewVal)
                        end
                end,
      state_set_subs(State, NewSubs).
  
  %% @doc Checks whether config parameters for tx_tm_rtm exist and are
  %%      valid.
  