def testIsValidBlockJumpDifficulty(lastBlock, block): jumpDifficulty = 10 block.dificulty = jumpDifficulty block.hash = f'{"0" * jumpDifficulty}111abc' with pytest.raises(Exception, match='difficulty must only adjust by 1'): Block.isValidBlock(lastBlock, block)
def testIsValidBadProofOfWork(lastBlock, block): block.hash = 'fff' with pytest.raises(Exception, match='proof of work requirement was not met'): Block.isValidBlock(lastBlock, block)
def testIsValidBlock(lastBlock, block): Block.isValidBlock(lastBlock, block)
def testIsValidBlockBadLastHash(lastBlock, block): block.lasthash = 'evil_LastHash' with pytest.raises(Exception, match='lastHash must be correct'): Block.isValidBlock(lastBlock, block)
def testIsValidBlockBadHash(lastBlock, block): block.hash = '0000000000000000bbbabc' with pytest.raises(Exception, match='block hash must be correct'): Block.isValidBlock(lastBlock, block)