def test_resets_current_transactions_when_mined(): bc = Blockchain() bc.new_transaction('a', 'b', 1) initial_length = len(bc.current_transactions) bc.new_block(123, 'abc') current_length = len(bc.current_transactions) assert initial_length == 1 assert current_length == 0
def test_block_creation(a_valid_block, proof=123, previous_hash='abc'): bc = Blockchain() block_a_tester = bc.new_block(proof, previous_hash) assert block_a_tester['index'] == a_valid_block['index'] assert isinstance(block_a_tester['timestamp'], type(a_valid_block['timestamp'])) assert block_a_tester['proof'] == a_valid_block['proof'] assert block_a_tester['previous_hash'] == a_valid_block['previous_hash']