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, }); }
private void InitBlockchain() { lock (_blockchainLock) { if (_blockchain != null) { return; } _blockchain = new CppBlockchain(this); } }
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); }
public virtual TransactionRecord GetTransactionRecord(SQLiteDataReader reader, BigintCache cache, AbstractBlockchain blockchain) { return(InternalGetTransactionRecord(reader, cache, blockchain)); }
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; } }