Exemplo n.º 1
0
 public IDataReader Create(
     object resultHandle,
     NativeExecutionContext nativeExecutionContext)
 {
     // TODO: Add a data reader that supports native access to the SQLite engine
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
        internal ExecutionContext GetContractContext(SmartContract contract)
        {
            if (HasContract(contract.Name))
            {
                // TODO this needs to suport non-native contexts too..
                var context = new NativeExecutionContext(contract);
                return(context);
            }

            return(null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Deletes all blocks starting at the specified hash.
        /// </summary>

        /*
         * public void DeleteBlocks(Hash targetHash)
         * {
         *  var targetBlock = FindBlockByHash(targetHash);
         *  Throw.IfNull(targetBlock, nameof(targetBlock));
         *
         *  var currentBlock = this.LastBlock;
         *  while (true)
         *  {
         *      Throw.IfNull(currentBlock, nameof(currentBlock));
         *
         *      var changeSet = _blockChangeSets[currentBlock.Hash];
         *      changeSet.Undo();
         *
         *      _blockChangeSets.Remove(currentBlock.Hash);
         *      _blockHeightMap.Remove(currentBlock.Height);
         *      _blocks.Remove(currentBlock.Hash);
         *
         *      currentBlock = FindBlockByHash(currentBlock.PreviousHash);
         *
         *      if (currentBlock.PreviousHash == targetHash)
         *      {
         *          break;
         *      }
         *  }
         * }*/

        internal ExecutionContext GetContractContext(StorageContext storage, SmartContract contract)
        {
            if (!IsContractDeployed(storage, contract.Address))
            {
                throw new ChainException($"contract {contract.Name} not deployed on {Name} chain");
            }

            // TODO this needs to suport non-native contexts too..
            var context = new NativeExecutionContext(contract);

            return(context);
        }
Exemplo n.º 4
0
        internal ExecutionContext GetContractContext(SmartContract contract)
        {
            if (_contractContexts.ContainsKey(contract.Name))
            {
                return(_contractContexts[contract.Name]);
            }

            if (HasContract(contract.Name))
            {
                // TODO this needs to suport non-native contexts too..
                var context = new NativeExecutionContext(contract);
                this._contractContexts[contract.Name] = context;
                return(context);
            }

            return(null);
        }