[Test] // because we decided to store the head block at 0x00..., eh public void Ommers_near_genesis_with_00_address_used() { Block falseOmmer = Build.A.Block.WithParent(Build.A.Block.WithDifficulty(123).TestObject).TestObject; Block toValidate = Build.A.Block.WithParent(_parent).WithOmmers(falseOmmer).TestObject; OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.False(ommersValidator.Validate(toValidate.Header, toValidate.Ommers)); }
public void When_more_than_two_ommers_returns_false() { BlockHeader[] ommers = GetValidOmmers(3); OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.False(ommersValidator.Validate(new BlockHeader(), ommers)); }
public void When_all_is_fine_returns_true() { BlockHeader[] ommers = GetValidOmmers(1); OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.True(ommersValidator.Validate(_block.Header, ommers)); }
public void Same_ommer_twice_returns_false() { BlockHeader[] ommers = GetValidOmmers(1).Union(GetValidOmmers(1)).ToArray(); OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.False(ommersValidator.Validate(_block.Header, ommers)); }
public void When_ommer_is_parent_returns_false() { BlockHeader[] ommers = new BlockHeader[1]; ommers[0] = _parent.Header; OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.False(ommersValidator.Validate(_block.Header, ommers)); }
public void When_ommer_is_self_returns_false() { BlockHeader[] ommers = new BlockHeader[1]; ommers[0] = _block.Header; OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, NullLogManager.Instance); Assert.False(ommersValidator.Validate(_block.Header, ommers)); }
public void Grandpas_brother_is_fine() { BlockHeader[] ommers = GetValidOmmers(1); ommers[0].Number = _grandparent.Number; ommers[0].ParentHash = _grandgrandparent.Hash; OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.True(ommersValidator.Validate(_block.Header, ommers)); }
public void When_ommer_is_brother_returns_false() { BlockHeader[] ommers = new BlockHeader[1]; ommers[0] = Build.A.BlockHeader.TestObject; ommers[0].ParentHash = _parent.Hash; ommers[0].Number = _block.Number; OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.False(ommersValidator.Validate(_block.Header, ommers)); }
public void When_ommer_is_brother_returns_false() { BlockHeader[] ommers = new BlockHeader[1]; ommers[0] = new BlockHeader(); ommers[0].ParentHash = _parent.Hash; ommers[0].Number = _block.Number; OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, NullLogManager.Instance); Assert.False(ommersValidator.Validate(_block.Header, ommers)); }
public void When_ommer_was_already_included_return_false() { OmmersValidator ommersValidator = new OmmersValidator(_blockTree, _headerValidator, LimboLogs.Instance); Assert.False(ommersValidator.Validate(_block.Header, new[] { _duplicateOmmer.Header })); }