public async Task GlobalCleanup() { foreach (var block in _blocks) { await _txHub.HandleBlockAcceptedAsync(new BlockAcceptedEvent { Block = block }); await _transactionManager.RemoveTransactionsAsync(block.Body.TransactionIds); await _transactionResultManager.RemoveTransactionResultsAsync(block.Body.TransactionIds, block.GetHash()); await _transactionResultManager.RemoveTransactionResultsAsync(block.Body.TransactionIds, block.Header.GetPreMiningHash()); await _chainManager.RemoveChainBlockLinkAsync(block.GetHash()); await _blockManager.RemoveBlockAsync(block.GetHash()); } await _txHub.HandleBestChainFoundAsync(new BestChainFoundEventData { BlockHash = _chain.BestChainHash, BlockHeight = _chain.BestChainHeight }); await _chains.SetAsync(_chain.Id.ToStorageKey(), _chain); }
public async Task IterationCleanup() { await _txHub.HandleBlockAcceptedAsync(new BlockAcceptedEvent { Block = _block }); await _txHub.HandleBestChainFoundAsync(new BestChainFoundEventData { BlockHash = _chain.BestChainHash, BlockHeight = _chain.BestChainHeight }); await _transactionManager.RemoveTransactionsAsync(_block.Body.TransactionIds); await _chainManager.RemoveChainBlockLinkAsync(_block.GetHash()); await _blockManager.RemoveBlockAsync(_block.GetHash()); await _chains.SetAsync(_chain.Id.ToStorageKey(), _chain); }
public async Task HandleEventAsync(BlockAcceptedEvent eventData) { await _txHub.HandleBlockAcceptedAsync(eventData); }