Exemple #1
0
        private FilterLog CreateLog(LogFilter logFilter, TxReceipt txReceipt, LogEntry logEntry, long index)
        {
            if (logFilter.FromBlock.Type == FilterBlockType.BlockNumber &&
                logFilter.FromBlock.BlockNumber > txReceipt.BlockNumber)
            {
                return(null);
            }

            if (logFilter.ToBlock.Type == FilterBlockType.BlockNumber && logFilter.ToBlock.BlockNumber < txReceipt.BlockNumber)
            {
                return(null);
            }

            if (!logFilter.Accepts(logEntry))
            {
                return(null);
            }

            if (logFilter.FromBlock.Type == FilterBlockType.Earliest ||
                logFilter.FromBlock.Type == FilterBlockType.Pending ||
                logFilter.ToBlock.Type == FilterBlockType.Earliest ||
                logFilter.ToBlock.Type == FilterBlockType.Pending)
            {
                return(new FilterLog(index, txReceipt, logEntry));
            }

            if (logFilter.FromBlock.Type == FilterBlockType.Latest || logFilter.ToBlock.Type == FilterBlockType.Latest)
            {
                //TODO: check if is last mined block
                return(new FilterLog(index, txReceipt, logEntry));
            }

            return(new FilterLog(index, txReceipt, logEntry));
        }
Exemple #2
0
        private FilterLog CreateLog(LogFilter logFilter, TransactionReceipt transactionReceipt, LogEntry logEntry)
        {
            if (logFilter.FromBlock.Type == FilterBlockType.BlockId &&
                logFilter.FromBlock.BlockId > transactionReceipt.BlockNumber)
            {
                return(null);
            }

            if (logFilter.ToBlock.Type == FilterBlockType.BlockId && logFilter.ToBlock.BlockId < transactionReceipt.BlockNumber)
            {
                return(null);
            }

            if (!logFilter.Accepts(logEntry))
            {
                return(null);
            }

            if (logFilter.FromBlock.Type == FilterBlockType.Earliest ||
                logFilter.FromBlock.Type == FilterBlockType.Pending ||
                logFilter.ToBlock.Type == FilterBlockType.Earliest ||
                logFilter.ToBlock.Type == FilterBlockType.Pending)
            {
                return(CreateLog(UInt256.One, transactionReceipt, logEntry));
            }

            if (logFilter.FromBlock.Type == FilterBlockType.Latest || logFilter.ToBlock.Type == FilterBlockType.Latest)
            {
                //TODO: check if is last mined block
                return(CreateLog(UInt256.One, transactionReceipt, logEntry));
            }

            return(CreateLog(UInt256.One, transactionReceipt, logEntry));
        }