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 AddBlockBody_Test() { var hash = Hash.FromString("hash"); var body = new BlockBody(); await _blockManager.AddBlockBodyAsync(hash, body); }
public async Task AddBlockBody_Test() { var hash = Hash.Generate(); var body = new BlockBody(); await _blockManager.AddBlockBodyAsync(hash, body); }