docs: private boolean checkExistingTxForPrepare(HotRodHeader header, PrepareCoordinator txCoordinator) {
        TxState txState = txCoordinator.getTxState();
        if (txState == null) {
           return false;
        }
        if (txCoordinator.isAlive(txState.getOriginator())) {
           //transaction started on another node but the node is still in the topology. 2 possible scenarios:
           // #1, the topology isn't updated
           // #2, the client timed-out waiting for the reply
           //in any case, we send a ignore reply and the client is free to retry (or rollback)
           writeNotExecuted(header);
           return true;
        }
        //originator is dead...
  
        //First phase state machine
        //success ACTIVE -> PREPARING -> PREPARED
        //failed ACTIVE -> MARK_ROLLBACK -> ROLLED_BACK or ACTIVE -> PREPARING -> ROLLED_BACK
        //1PC success ACTIVE -> PREPARING -> MARK_COMMIT -> COMMITTED
        switch (txState.getStatus()) {
           case ACTIVE:
           case PREPARING:
              //rollback existing transaction and retry with a new one
              txCoordinator.rollbackRemoteTransaction(txState.getGlobalTransaction());
              return false;
           case PREPARED:
              //2PC since 1PC never reaches this state
              writeResponse(header, createTransactionResponse(header, XAResource.XA_OK));
              return true;
           case MARK_ROLLBACK:
              //make sure it is rolled back and reply to the client
              txCoordinator.rollbackRemoteTransaction(txState.getGlobalTransaction());
           case ROLLED_BACK:
              writeResponse(header, createTransactionResponse(header, XAException.XA_RBROLLBACK));
              return true;
           case MARK_COMMIT:
              writeResponse(header, createTransactionResponse(header, txCoordinator.onePhaseCommitRemoteTransaction(txState.getGlobalTransaction(), txState.getModifications())));
              return true;
           case COMMITTED:
              writeResponse(header, createTransactionResponse(header, XAResource.XA_OK));
              return true;
           default:
              throw new IllegalStateException();
        }
     }