Example #1
0
        private RunTime(Transaction tx, BlockCapsule block, Deposit deposit, IProgramInvokeFactory invoke_factory)
        {
            this.transaction      = tx;
            this.deposit          = deposit;
            this.invoke_factory   = invoke_factory;
            this.executor_type    = ExecutorType.ET_PRE_TYPE;
            this.block            = block;
            this.energy_processor = new EnergyProcessor(deposit.DBManager);
            ContractType contract_type = tx.RawData.Contract[0].Type;

            switch (contract_type)
            {
            case ContractType.TriggerSmartContract:
            {
                this.transaction_type = TransactionType.TX_CONTRACT_CALL_TYPE;
            }
            break;

            case ContractType.CreateSmartContract:
            {
                this.transaction_type = TransactionType.TX_CONTRACT_CREATION_TYPE;
            }
            break;

            default:
            {
                this.transaction_type = TransactionType.TX_PRECOMPILED_TYPE;
            }
            break;
            }
        }
Example #2
0
        public RunTime(TransactionTrace trace, BlockCapsule block, Deposit deposit, IProgramInvokeFactory invoke_factory)
        {
            this.trace       = trace;
            this.transaction = trace.Transaction.Instance;

            if (block != null)
            {
                this.block         = block;
                this.executor_type = ExecutorType.ET_NORMAL_TYPE;
            }
            else
            {
                this.block         = new BlockCapsule(new Block());
                this.executor_type = ExecutorType.ET_PRE_TYPE;
            }
            this.deposit          = deposit;
            this.invoke_factory   = invoke_factory;
            this.energy_processor = new EnergyProcessor(deposit.DBManager);

            ContractType contract_type = this.transaction.RawData.Contract[0].Type;

            switch (contract_type)
            {
            case ContractType.TriggerSmartContract:
            {
                this.transaction_type = TransactionType.TX_CONTRACT_CALL_TYPE;
            }
            break;

            case ContractType.CreateSmartContract:
            {
                this.transaction_type = TransactionType.TX_CONTRACT_CREATION_TYPE;
            }
            break;

            default:
            {
                this.transaction_type = TransactionType.TX_PRECOMPILED_TYPE;
            }
            break;
            }
        }
Example #3
0
 public RunTime(Transaction tx, BlockCapsule block, Deposit deposit, IProgramInvokeFactory invoke_factory, bool is_static_call)
     : this(tx, block, deposit, invoke_factory)
 {
     this.is_static_call = is_static_call;
 }