public async Task GetBlock_Header_And_Body_Test() { var block = _kernelTestHelper.GenerateBlock(0, Hash.Empty); var blockHash = block.GetHash(); await _blockManager.AddBlockHeaderAsync(block.Header); var blockHeader = await _blockManager.GetBlockHeaderAsync(blockHash); Assert.Equal(blockHeader, block.Header); var storedBlock = await _blockManager.GetBlockAsync(blockHash); storedBlock.ShouldBeNull(); await _blockManager.AddBlockBodyAsync(blockHash, block.Body); storedBlock = await _blockManager.GetBlockAsync(blockHash); Assert.Equal(storedBlock.Header, block.Header); Assert.Equal(storedBlock.Body, block.Body); (await _blockManager.HasBlockAsync(blockHash)).ShouldBeTrue(); await _blockManager.RemoveBlockAsync(blockHash); await _blockManager.AddBlockBodyAsync(blockHash, block.Body); storedBlock = await _blockManager.GetBlockAsync(blockHash); storedBlock.ShouldBeNull(); (await _blockManager.HasBlockAsync(blockHash)).ShouldBeFalse(); }
public async Task AddBlockAsync(Block block) { await _blockManager.AddBlockHeaderAsync(block.Header); foreach (var transaction in block.Body.TransactionList) { await _transactionManager.AddTransactionAsync(transaction); } await _blockManager.AddBlockBodyAsync(block.Header.GetHash(), block.Body); }
public async Task AddBlockAsync(Block block) { await _blockManager.AddBlockBodyAsync(block.Header.GetHash(), block.Body); await _blockManager.AddBlockHeaderAsync(block.Header); }
public async Task AddBlockHeaderTest() { var header = _kernelTestHelper.GenerateBlock(0, Hash.Empty).Header; await _blockManager.AddBlockHeaderAsync(header); }
public async Task AddBlockHeaderTest() { var header = new BlockHeader(); await _blockManager.AddBlockHeaderAsync(header); }