public WalletService(KeyManager keyManager, IndexDownloader indexDownloader, CcjClient chaumianClient, MemPoolService memPool, NodesGroup nodes, string blocksFolderPath) { KeyManager = Guard.NotNull(nameof(keyManager), keyManager); Nodes = Guard.NotNull(nameof(nodes), nodes); IndexDownloader = Guard.NotNull(nameof(indexDownloader), indexDownloader); ChaumianClient = Guard.NotNull(nameof(chaumianClient), chaumianClient); MemPool = Guard.NotNull(nameof(memPool), memPool); WalletBlocks = new SortedDictionary <Height, uint256>(); ProcessedBlocks = new HashSet <uint256>(); WalletBlocksLock = new AsyncLock(); HandleFiltersLock = new AsyncLock(); Coins = new ConcurrentHashSet <SmartCoin>(); BlocksFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(blocksFolderPath), blocksFolderPath, trim: true); BlockFolderLock = new AsyncLock(); BlockDownloadLock = new AsyncLock(); AssertCleanKeysIndexed(21); _running = 0; if (Directory.Exists(BlocksFolderPath)) { if (IndexDownloader.Network == Network.RegTest) { Directory.Delete(BlocksFolderPath, true); Directory.CreateDirectory(BlocksFolderPath); } } else { Directory.CreateDirectory(BlocksFolderPath); } IndexDownloader.NewFilter += IndexDownloader_NewFilterAsync; IndexDownloader.Reorged += IndexDownloader_ReorgedAsync; MemPool.TransactionReceived += MemPool_TransactionReceived; }
public MemPoolBehavior(MemPoolService memPoolService) { MemPoolService = Guard.NotNull(nameof(memPoolService), memPoolService); }