Ejemplo n.º 1
0
def script__one_hash__literal__same():
    hash_one = bc.hash_literal(
        "0000000000000000000000000000000000000000000000000000000000000001")
    one_hash = bc.HashDigest.from_bytes(
        [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    assert hash_one == one_hash
Ejemplo n.º 2
0
def transaction__hash__block320670__success():
    expected = bc.hash_literal(TX7_HASH)
    data = bytes.fromhex(TX7)
    instance = bc.Transaction.from_data(data)
    assert instance is not None
    assert expected == instance.hash()
    assert data == instance.to_data()
Ejemplo n.º 3
0
def transaction__constructor_6__valid_input__returns_input_initialized():
    raw_tx = bytes.fromhex(TX1)
    expected = bc.Transaction.from_data(raw_tx)
    expected_hash = bc.hash_literal(TX1_HASH)

    instance = expected.copy(expected_hash)
    assert instance is not None
    assert instance.is_valid()
    assert expected_hash == instance.hash()
Ejemplo n.º 4
0
def transaction__factory_data_1__case_2__success():
    tx_hash = bc.hash_literal(TX4_HASH)
    raw_tx = bytes.fromhex(TX4)
    assert len(raw_tx) == 523

    tx = bc.Transaction.from_data(raw_tx)
    assert tx is not None
    assert tx.is_valid()
    assert tx.hash() == tx_hash

    assert tx.serialized_size() == len(raw_tx)
    resave = tx.to_data()
    assert resave == raw_tx
Ejemplo n.º 5
0
 def python_value(self, value):
     if value is None:
         return None
     return bc.hash_literal(value)