Ejemplo n.º 1
0
        public BlockFilter CreateBlockFilter(long startBlockNumber, bool setId = true)
        {
            var filterId    = setId ? GetFilterId() : 0;
            var blockFilter = new BlockFilter(filterId, startBlockNumber);

            return(blockFilter);
        }
Ejemplo n.º 2
0
        private void StoreBlock(BlockFilter filter, Block block)
        {
            if (block.Hash == null)
            {
                throw new InvalidOperationException("Cannot filter on blocks without calculated hashes");
            }

            var blocks = _blockHashes.GetOrAdd(filter.Id, i => new List <Keccak>());

            blocks.Add(block.Hash);
            if (_logger.IsDebug)
            {
                _logger.Debug($"Filter with id: '{filter.Id}' contains {blocks.Count} blocks.");
            }
        }