public async Task ValidateBlock_Success() { var chain = await _blockchainService.GetChainAsync(); var block = _osTestHelper.GenerateBlockWithTransactions(chain.LastIrreversibleBlockHash, chain.LastIrreversibleBlockHeight); var validateResult = await _blockSyncValidationService.ValidateBlockAsync(chain, block, GetEncodedPubKeyString()); validateResult.ShouldBeTrue(); }
private async Task ProcessNewBlockAsync(BlockWithTransactions blockWithTransactions, string senderPubkey) { Logger.LogDebug($"Start full block sync job, block: {blockWithTransactions}, peer: {senderPubkey}."); var chain = await _blockchainService.GetChainAsync(); if (!await _blockSyncValidationService.ValidateBlockAsync(chain, blockWithTransactions, senderPubkey)) { return; } await _blockSyncService.SyncByBlockAsync(chain, new SyncBlockDto { BlockWithTransactions = blockWithTransactions, BatchRequestBlockCount = _blockSyncOptions.MaxBatchRequestBlockCount, SuggestedPeerPubkey = senderPubkey }); }