public IEnumerable <string> GetFilterLinesExcluding(uint256 bestKnownBlockHash, int count, out bool found)
        {
            using (IndexLock.Lock())
            {
                found = false;                 // Only build the filter list from when the known hash is found.
                var filters = new List <string>();
                foreach (var filter in Index)
                {
                    if (found)
                    {
                        filters.Add(filter.ToLine());
                        if (filters.Count >= count)
                        {
                            break;
                        }
                    }
                    else
                    {
                        if (filter.BlockHash == bestKnownBlockHash)
                        {
                            found = true;
                        }
                    }
                }

                return(filters);
            }
        }
예제 #2
0
        public (Height bestHeight, IEnumerable <string> filters) GetFilterLinesExcluding(uint256 bestKnownBlockHash, int count, out bool found)
        {
            using (IndexLock.Lock())
            {
                found = false;                 // Only build the filter list from when the known hash is found.
                var filters = new List <string>();
                foreach (var filter in Index)
                {
                    if (found)
                    {
                        filters.Add(filter.ToLine());
                        if (filters.Count >= count)
                        {
                            break;
                        }
                    }
                    else
                    {
                        if (filter.BlockHash == bestKnownBlockHash)
                        {
                            found = true;
                        }
                    }
                }

                if (Index.Count == 0)
                {
                    return(Height.Unknown, Enumerable.Empty <string>());
                }
                else
                {
                    return(Index.Last().BlockHeight, filters);
                }
            }
        }
예제 #3
0
        public IEnumerable <string> GetFilterLinesExcluding(uint256 bestKnownBlockHash, out bool found)
        {
            using (IndexLock.Lock())
            {
                found = false;
                var filters = new List <string>();
                foreach (var filter in Index)
                {
                    if (found)
                    {
                        filters.Add(filter.ToLine());
                    }
                    else
                    {
                        if (filter.BlockHash == bestKnownBlockHash)
                        {
                            found = true;
                        }
                    }
                }

                return(filters);
            }
        }