Ejemplo n.º 1
0
            protected virtual TransactionRecord InternalGetTransactionRecord(SQLiteDataReader reader, BigintCache cache,
                                                                             AbstractBlockchain blockchain)
            {
                if (!reader.Read())
                {
                    return(null);
                }
                var hash      = (string)reader[0];
                var sender    = (long)reader[1];
                var receiver  = (long)reader[2];
                var value     = (string)reader[3];
                var blockHash = (string)reader[4];
                var block     = blockchain.GetBlockByHash(blockHash);

                return(new TransactionRecord
                {
                    Hash = hash,
                    Sender = cache?.Decode(sender),
                    Receiver = cache?.Decode(receiver),
                    Value = value,
                    BlockHash = blockHash,
                    BlockHeight = block.Height,
                    Order = Order,
                });
            }
Ejemplo n.º 2
0
 private void InitBlockchain()
 {
     lock (_blockchainLock)
     {
         if (_blockchain != null)
         {
             return;
         }
         _blockchain = new CppBlockchain(this);
     }
 }
Ejemplo n.º 3
0
            public override TransactionRecord GetTransactionRecord(SQLiteDataReader reader, BigintCache cache, AbstractBlockchain blockchain)
            {
                var ret = InternalGetTransactionRecord(reader, null, blockchain);

                if (ret == null)
                {
                    return(ret);
                }
                ret.Value    = Amount;
                ret.Sender   = Sender;
                ret.Receiver = Receiver;
                return(ret);
            }
Ejemplo n.º 4
0
 public virtual TransactionRecord GetTransactionRecord(SQLiteDataReader reader, BigintCache cache, AbstractBlockchain blockchain)
 {
     return(InternalGetTransactionRecord(reader, cache, blockchain));
 }
Ejemplo n.º 5
0
 public void Dispose()
 {
     if (_conn != null)
     {
         _conn.Dispose();
         _conn = null;
     }
     if (_blockchain != null)
     {
         _blockchain.Dispose();
         _blockchain = null;
     }
     if (_cache != null)
     {
         _cache.Dispose();
         _cache = null;
     }
     if (_insertBlock != null)
     {
         _insertBlock.Dispose();
         _insertBlock = null;
     }
     if (_insertTransaction != null)
     {
         _insertTransaction.Dispose();
         _insertTransaction = null;
     }
     if (_readTx != null)
     {
         _readTx.Dispose();
         _readTx = null;
     }
     if (_readGasPrices != null)
     {
         _readGasPrices.Dispose();
         _readGasPrices = null;
     }
     if (_readAverageGasPrice != null)
     {
         _readAverageGasPrice.Dispose();
         _readAverageGasPrice = null;
     }
     if (_writeAverageGasPrice != null)
     {
         _writeAverageGasPrice.Dispose();
         _writeAverageGasPrice = null;
     }
     if (_getHistoryByTxId != null)
     {
         _getHistoryByTxId.Dispose();
         _getHistoryByTxId = null;
     }
     if (_getTxsByAddress != null)
     {
         _getTxsByAddress.Dispose();
         _getTxsByAddress = null;
     }
     if (_getTokenTxsByAddress != null)
     {
         _getTokenTxsByAddress.Dispose();
         _getTokenTxsByAddress = null;
     }
     if (_insertTokenTransaction != null)
     {
         _insertTokenTransaction.Dispose();
         _insertTokenTransaction = null;
     }
     if (_getTransactionsToAddressInBlock != null)
     {
         _getTransactionsToAddressInBlock.Dispose();
         _getTransactionsToAddressInBlock = null;
     }
     if (_inputStore != null)
     {
         _inputStore.Dispose();
         _inputStore = null;
     }
     if (_logsStore != null)
     {
         _logsStore.Dispose();
         _logsStore = null;
     }
 }