execute transaction
 @param t Transaction
 @param header Chain::Header
426308
def execute_transaction(t, header: nil, block_info: nil, ignore_exception: false)
      unless state.find_account(t.sender).balance >= t.gas_price * t.gas_limit + t.value
        raise InvalidTransaction.new('account balance not enough')
      end

      # remove gas fee from account balance
      state.add_balance(t.sender, -1 * t.gas_limit * t.gas_price)

      intrinsic_gas = fork_schema.intrinsic_gas_of_transaction(t)
      if intrinsic_gas > t.gas_limit
        raise InvalidTransaction.new('intrinsic gas overflowed gas limit')
      end

      gas_limit = t.gas_limit - intrinsic_gas

      instruction = Instruction.new(
        origin: t.sender,
        price: t.gas_price,
        sender: t.sender,
        value: t.value,
        header: header,
      )

      if t.contract_creation?
        instruction.bytes_code = t.data
      else
        instruction.bytes_code = get_account_code(t.to)
        instruction.address = t.to
        instruction.data = t.data
      end

      block_info ||= header && BlockInfo.from_header(header)
      context = Ciri::EVM::ExecutionContext.new(
        instruction: instruction, gas_limit: gas_limit,
        block_info: block_info, fork_schema: fork_schema
      )
      vm = Ciri::EVM::VM.new(state: state, chain: @chain, burn_gas_on_exception: true)

      unless instruction.value > state.find_account(instruction.sender).balance
        state.increment_nonce(instruction.sender)
      end

      vm.with_context(context) do
        if t.contract_creation?
          # contract creation
          vm.create_contract(context: context)
        else
          vm.call_message(context: context)
        end
        raise context.exception if !ignore_exception && context.exception

        # refund gas
        sub_state_refund_gas = fork_schema.calculate_refund_gas(vm)
        context.refund_gas(sub_state_refund_gas)
        refund_gas = context.reset_refund_gas
        remain_gas = context.remain_gas
        actually_gas_used = t.gas_limit - remain_gas
        actually_refund_gas = [refund_gas, actually_gas_used / 2].min
        refund_gas_amount = (actually_refund_gas + remain_gas) * t.gas_price
        debug("Transaction refund #{refund_gas_amount} to #{t.sender.to_s.hex}")
        state.add_balance(t.sender, refund_gas_amount)

        # gas_used after refund gas
        gas_used = actually_gas_used - actually_refund_gas

        # miner fee
        fee = gas_used * t.gas_price
        debug("Transaction fee #{fee}")
        miner_account = find_account(block_info.coinbase)
        miner_account.balance += fee
        state.set_balance(block_info.coinbase, miner_account.balance)

        # EIP158 fork, we need to delete miner account if account become empty
        vm.sub_state.add_touched_account(block_info.coinbase)
        vm.delete_empty_accounts

        # destroy accounts
        vm.execution_context.all_suicide_accounts.each do |address|
          state.set_balance(address, 0)
          state.delete_account(address)
        end

        ExecutionResult.new(status: context.status, state_root: state_root, logs: context.all_log_series,
                            gas_used: gas_used, gas_price: t.gas_price, exception: context.exception,
                            output: context.output)
      end
    end
1309114
def _ExecuteTransaction(self, transaction):
    """"""

    def Action(connection):
      connection.cursor.execute("START TRANSACTION")
      for query in transaction:
        connection.cursor.execute(query["query"], query["args"])
      connection.cursor.execute("COMMIT")
      return connection.cursor.fetchall()

    return self._RetryWrapper(Action)
1362556
function TransactionTask(readOnly, txnCallback, errorCallback, successCallback) {
  this.readOnly = readOnly;
  this.txnCallback = txnCallback;
  this.errorCallback = errorCallback;
  this.successCallback = successCallback;
}
500958
public function handle(TransactionHandler $transaction)
    {
        if ($this->sheetImport instanceof WithCustomValueBinder) {
            Cell::setValueBinder($this->sheetImport);
        }

        $headingRow = HeadingRowExtractor::headingRow($this->sheetImport);

        $filter = new ChunkReadFilter(
            $headingRow,
            $this->startRow,
            $this->chunkSize,
            $this->sheetName
        );

        $this->reader->setReadFilter($filter);
        $this->reader->setReadDataOnly(true);
        $this->reader->setReadEmptyCells(false);

        $spreadsheet = $this->reader->load(
            $this->temporaryFile->sync()->getLocalPath()
        );

        $sheet = Sheet::byName(
            $spreadsheet,
            $this->sheetName
        );

        if ($sheet->getHighestRow() < $this->startRow) {
            $sheet->disconnect();

            return;
        }

        $transaction(function () use ($sheet) {
            $sheet->import(
                $this->sheetImport,
                $this->startRow
            );

            $sheet->disconnect();
        });
    }
718919
public <Ex extends Throwable> Try<R,Ex> execute(T input,Class<Ex> classes){
		
		return Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)),classes);
		 
	}
182924
public void processTransactionTerminated(
			TransactionTerminatedEvent txTerminatedEvent) {
		
		Transaction t = null; 
		if (txTerminatedEvent.isServerTransaction()) {
			t = txTerminatedEvent.getServerTransaction();
		}
		else {
			t = txTerminatedEvent.getClientTransaction();
		}
		
		final TransactionWrapper tw = getTransactionWrapper(t);
		if (tw != null) {
			if (tracer.isInfoEnabled()) {
				tracer.info("SIP Transaction "+tw.getActivityHandle()+" terminated");
			}
			processTransactionTerminated(tw);			
		}
		else {			
			if (tracer.isInfoEnabled()) {
				tracer.info("SIP Transaction "+((SIPTransaction)t).getTransactionId()+" terminated");				
			}
		}		
	}
756710
protected void executeTx(final TxRunnable r, final TxRunnable errorHandler) throws Exception {
        Transaction transaction = beginTransaction();
        configureTransDefault(transaction);
        processTransactionError(transaction, t -> {
            try {
                r.run(t);
                t.commit();
            } catch (Throwable e) {
                t.rollback(e);
                throw e;
            } finally {
                t.end();
            }
            return null;
        }, errorHandler != null ? (TxCallable) t -> {
            errorHandler.run(t);
            return null;
        } : null);
    }
139444
public void runInTransaction(Runnable runnable)
    throws DataAccessException {
        TransactionWrapper transaction=null;
        try {
            transaction = startTransaction();
            runnable.run();
        } finally {
            stopTransaction(transaction);
        }
    }
958968
def apply_transaction(
            self,
            transaction: BaseOrSpoofTransaction) -> 'BaseComputation':
        
        if self.state_root != BLANK_ROOT_HASH and not self._account_db.has_root(self.state_root):
            raise StateRootNotFound(self.state_root)
        else:
            return self.execute_transaction(transaction)
1040105
def _execute_transactions(self, address):
        
        for i in range(self.transaction_count):
            self.time = datetime.now()
            log.info(
                "Starting message call transaction, iteration: {}, {} initial states".format(
                    i, len(self.open_states)
                )
            )
            for hook in self._start_sym_trans_hooks:
                hook()

            execute_message_call(self, address)

            for hook in self._stop_sym_trans_hooks:
                hook()
1099072
public void update( Transaction transaction ) {
    RestfulUtils.update( TransactionService.PATH, transaction, Transaction.class, super.httpClient );
  }
472910
public void execute() {
        State currentState = state.getAndSet(State.RUNNING);
        if (currentState == State.RUNNING) {
            throw new IllegalStateException(
                    "ExecutionChain is already running!");
        }
        executeRunnable = new ExecuteRunnable();
    }
879879
@Override
    public synchronized void commit(boolean chain) {

//        tempActionHistory.add("commit " + actionTimestamp);
        if (isClosed) {
            return;
        }

        if (!isTransaction) {
            isReadOnly    = isReadOnlyDefault;
            isolationMode = isolationModeDefault;

            return;
        }

        if (!database.txManager.commitTransaction(this)) {

//            tempActionHistory.add("commit aborts " + actionTimestamp);
            rollback(false);

            throw Error.error(ErrorCode.X_40001);
        }

        endTransaction(true);
    }
1371149
@Override
    public synchronized void rollback(boolean chain) {

        //        tempActionHistory.add("rollback " + actionTimestamp);
        if (isClosed) {
            return;
        }

        if (!isTransaction) {
            isReadOnly    = isReadOnlyDefault;
            isolationMode = isolationModeDefault;

            return;
        }

        try {
            database.logger.writeToLog(this, Tokens.T_ROLLBACK);
        } catch (HsqlException e) {}

        database.txManager.rollback(this);
        endTransaction(false);
    }
1008850
public function execute()
    {
        parent::execute();
        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsManageTokens = $xml->createElement('hps:ManageTokens');

        $hpsManageTokens->appendChild($xml->createElement('hps:TokenValue', trim((string)$this->token)));

        $hpsTokenActions = $xml->createElement('hps:TokenActions');
        $hpsSet = $xml->createElement('hps:Set');
        $hpsAttribute = $xml->createElement('hps:Attribute');

        $hpsAttribute->appendChild($xml->createElement('hps:Name', 'ExpMonth'));
        $hpsAttribute->appendChild($xml->createElement('hps:Value', (string)sprintf("%'.02d", (int)$this->expMonth)));

        $hpsSet->appendChild($hpsAttribute);

        $hpsAttribute = $xml->createElement('hps:Attribute');

        $hpsAttribute->appendChild($xml->createElement('hps:Name', 'ExpYear'));
        $hpsAttribute->appendChild($xml->createElement('hps:Value', (string)$this->expYear));

        $hpsSet->appendChild($hpsAttribute);

        $hpsTokenActions->appendChild($hpsSet);

        $hpsManageTokens->appendChild($hpsTokenActions);

        $hpsTransaction->appendChild($hpsManageTokens);
        $trans = $this->service->_submitTransaction($hpsTransaction, 'ManageTokens', null);

        $trans->responseCode = '00';
        $trans->responseText = '';

        return $trans;
    }
1047191
protected void sendTransacted(Destination destination, Serializable message) {
        send(destination, message, null, null, true);
    }
772995
def send_response(self, transaction):
        
        if transaction.cacheHit is False:
            """
            handling response based on the code
            """
            logger.debug("handling response")
            self._handle_response(transaction)
        return transaction