Example #1
0
 def test_integrity_modified_nonce(self):
     block = Block(timestamp, transaction, index, previous_hash)
     block.mine_block(2)
     block.nonce = -1    # Pray it doesnt it the correct nonce...
     self.assertNotEqual(block.currentHash, block.calculate_hash())
Example #2
0
 def test_integrity_modified_transaction_list_null(self):
     block = Block(timestamp, [transaction, Transaction(from_address, to_address, amount, node_identifier)], index, previous_hash)
     block.mine_block(2)
     block.transactions = None
     self.assertNotEqual(block.currentHash, block.calculate_hash())
Example #3
0
 def test_integrity_modified_previous_hash(self):
     block = Block(timestamp, transaction, index, previous_hash)
     block.mine_block(2)
     block.previousHash = "wrongHash"
     self.assertNotEqual(block.currentHash, block.calculate_hash())
Example #4
0
 def test_integrity_modified_timestamp(self):
     block = Block(timestamp, transaction, index, previous_hash)
     block.mine_block(2)
     block.timestamp = datetime.now()
     self.assertNotEqual(block.currentHash, block.calculate_hash())