public DispatchController( BoundedInbox inbox, BoundedInbox chainControllerBox, BoundedInbox[] coinControllerBoxes, IOutpointHash hash, ILog log = null) { if (coinControllerBoxes.Length == 0) { throw new ArgumentException(nameof(coinControllerBoxes)); } _queue = new ConcurrentQueue <ConnectionController>(); _inbox = inbox; _chainControllerBox = chainControllerBox; _coinControllerBoxes = coinControllerBoxes; _hash = hash; _log = log; _mre = new ManualResetEvent(false); OnCoinMessageDispatched = new Action[_coinControllerBoxes.Length]; _connections = new Dictionary <ClientId, ConnectionController>(); }
public CoinControllerTests() { var mockHash = new Mock <IOutpointHash>(); mockHash.Setup(x => x.Hash(ref It.Ref <Outpoint> .IsAny)) .Returns((Outpoint p) => BinaryPrimitives.ReadUInt64BigEndian(new ReadOnlySpan <byte>(p.TxId, 8))); _hash = mockHash.Object; _rand = new Random(2); }
public CoinController(BoundedInbox inbox, BoundedInbox outbox, ICoinStore store, IOutpointHash hash, ILog log = null, int shardIndex = -1) { _inbox = inbox; _outbox = outbox; _store = store; _hash = hash; _log = log; _shardIndex = shardIndex; _pool = new SpanPool <byte>(PoolSizeInBytes); _mre = new ManualResetEvent(false); }
private static ICoinStore GetSozuTable(IPackStore store, IOutpointHash hash) { return(new SozuTable(store, hash)); }
public SozuTable(IPackStore store, IOutpointHash hash) { _store = store; _hash = hash; _pool = new SpanPool <byte>(SpanPoolCapacity); }