Пример #1
0
        public IEnumerable <SolidityLogInfo> GetLogs(List <IEnumerable <byte> > blockHashes, IEnumerable <byte> scHash)
        {
            if (blockHashes == null)
            {
                throw new ArgumentNullException(nameof(blockHashes));
            }

            if (scHash == null)
            {
                throw new ArgumentNullException(nameof(scHash));
            }

            var result = new List <SolidityLogInfo>();

            foreach (var blockHash in blockHashes)
            {
                var logValue = string.Empty;
                if (!_db.TryGet(string.Format(SMART_CONTRACT_LOG_ELT, blockHash.ToHexString(), scHash.ToHexString()), ReadOptions.Default, out logValue))
                {
                    continue;
                }

                var newTopics = new List <DataWord>();
                var record    = new SolidityLogInfo(newTopics, logValue.FromHexString().ToArray());
                var topics    = _db.Find(ReadOptions.Default, string.Format(SMART_CONTRACT_TOPIC_ELT, logValue));
                foreach (var topic in topics)
                {
                    newTopics.Add(new DataWord(topic.Value.FromHexString().ToArray()));
                }

                result.Add(record);
            }

            return(result);
        }
 public void AddLogInfo(SolidityLogInfo logInfo)
 {
     _logInfos.Add(logInfo);
 }