public async Task ValidateBlock_Success() { var chain = await _blockchainService.GetChainAsync(); var block = _osTestHelper.GenerateBlockWithTransactions(chain.LastIrreversibleBlockHash, chain.LastIrreversibleBlockHeight); var pubkey = (await _accountService.GetPublicKeyAsync()).ToHex(); var validateResult = await _blockSyncValidationService.ValidateBlockBeforeSyncAsync(chain, block, pubkey); validateResult.ShouldBeTrue(); }
private async Task ProcessNewBlockAsync(BlockWithTransactions blockWithTransactions, string senderPubkey) { var chain = await _blockchainService.GetChainAsync(); if (!await _blockSyncValidationService.ValidateBlockBeforeSyncAsync(chain, blockWithTransactions, senderPubkey)) { return; } await _blockSyncService.SyncByBlockAsync(chain, new SyncBlockDto { BlockWithTransactions = blockWithTransactions, BatchRequestBlockCount = _blockSyncOptions.MaxBatchRequestBlockCount, SuggestedPeerPubkey = senderPubkey }); }