示例#1
0
        private int GetTxReceiptsLength(Block block, bool useIterator)
        {
            if (useIterator)
            {
                int txReceiptsLength = 0;
                if (_receiptStorage.TryGetReceiptsIterator(block.Number, block.Hash, out var iterator))
                {
                    try
                    {
                        while (iterator.TryGetNext(out _))
                        {
                            txReceiptsLength++;
                        }
                    }
                    finally
                    {
                        iterator.Dispose();
                    }
                }

                return(txReceiptsLength);
            }
            else
            {
                return(_receiptStorage.Get(block)?.Where(r => r != null).Count() ?? 0);
            }
        }
示例#2
0
 public bool TryGetReceiptsIterator(long blockNumber, Keccak blockHash, out ReceiptsIterator iterator) => _outStorage.TryGetReceiptsIterator(blockNumber, blockHash, out iterator);