예제 #1
0
def test_create_transaction():
    bc = Blockchain()
    bc.new_transaction('a', 'b', 1)
    transaction = bc.current_transactions[-1]

    assert transaction
    assert transaction['sender'] == 'a'
    assert transaction['recipient'] == 'b'
    assert transaction['amount'] == 1
예제 #2
0
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
예제 #3
0
def one_transaction():
    bc = Blockchain()
    bc.new_transaction('a', 'b', 1)