System.Collections.Generic.HashSet.Contains(UInt256)

Here are the examples of the csharp api System.Collections.Generic.HashSet.Contains(UInt256) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : MemoryPool.cs
with MIT License
from ZoroChain

public Transaction[] TakeUnverifiedTransactions(int count)
        {
            return _sorted_items.Where(p => !_reverifying_items.Contains(p.tx.Hash) && _unverified.ContainsKey(p.tx.Hash))
                .Take(count)
                .Select(p => {
                    _reverifying_items.Add(p.tx.Hash);
                    return p.tx;
                }).ToArray();
        }

19 Source : TaskManager.cs
with MIT License
from ZoroChain

private void OnNewTasks(InvPayload payload)
        {
            if (!sessions.TryGetValue(Sender, out TaskSession session))
                return;
            if (payload.Type == InventoryType.TX && blockchain.Height < (int)blockchain.HeaderHeight - 100)
            {
                RequestTasks(session);
                return;
            }
            HashSet<UInt256> hashes = new HashSet<UInt256>(payload.Hashes);
            hashes.ExceptWith(knownHashes);
            if (payload.Type == InventoryType.Block)
                session.AvailableTasks.UnionWith(hashes.Where(p => globalTasks.Contains(p)));

            hashes.ExceptWith(globalTasks);
            if (hashes.Count == 0)
            {
                RequestTasks(session);
                return;
            }
            globalTasks.UnionWith(hashes);
            foreach (UInt256 hash in hashes)
            {
                session.Tasks[hash] = new TaskSession.Task { Type = payload.Type, BeginTime = DateTime.UtcNow };
            }
            RequestInventoryData(payload.Type, hashes.ToArray(), Sender);
        }