def test_non_equality_of_copies_off_genesis(empty_just): validator_0 = Validator("v0", 10) validator_1 = Validator("v1", 11) block_0 = Block(None, empty_just, validator_0, 0, 0) block_1 = Block(None, empty_just, validator_1, 0, 0) assert block_0 != block_1
def set_initial_messages(self): initial_message = Block( None, dict(), self.global_validator_set.get_validator_by_name(0), -1, 0) self.register_message(initial_message, get_random_str(10)) for validator in self.global_validator_set: validator.initialize_view([initial_message])
def test_is_in_blockchain__separate_genesis(empty_just): validator_0 = Validator("v0", 10) validator_1 = Validator("v1", 11) block_0 = Block(None, empty_just, validator_0, 0, 0) block_1 = Block(None, empty_just, validator_1, 0, 0) assert not block_0.is_in_blockchain(block_1) assert not block_1.is_in_blockchain(block_0)
def test_is_in_blockchain_separate_genesis(blockchain_validator_set): validator_0 = blockchain_validator_set.get_validator_by_name(0) validator_1 = blockchain_validator_set.get_validator_by_name(1) block_0 = Block(None, {}, validator_0, 0, 0) block_1 = Block(None, {}, validator_1, 0, 0) assert not block_0.is_in_blockchain(block_1) assert not block_1.is_in_blockchain(block_0)
def test_equality_of_copies_off_genesis(validator, empty_just): block = Block(None, empty_just, validator, 0, 0) shallow_copy = copy.copy(block) assert block == shallow_copy
def test_accepts_valid_estimates(estimate, is_valid, block): if estimate == 'block': Block.is_valid_estimate(block) == is_valid return assert Block.is_valid_estimate(estimate) == is_valid
def initial_message(cls, validator): if not cls.genesis_block: cls.genesis_block = Block(None, dict(), validator, -1, 0) return cls.genesis_block
def test_equality_of_copies_off_genesis(blockchain_validator): block = Block(None, {}, blockchain_validator, 0, 0) shallow_copy = copy.copy(block) assert block == shallow_copy
def test_accepts_valid_estimates(estimate, is_valid): assert Block.is_valid_estimate(estimate) == is_valid