Exemplo n.º 1
0
def test_TestCreateUnspent():
    err, pubkey, seckey, address = utils.makeKeysAndAddress()
    assert err == skycoin.SKY_OK
    hash1 = skycoin.cipher_SHA256()
    handle = utils.makeEmptyTransaction()
    err = skycoin.SKY_coin_Transaction_PushOutput(handle, address, 11000000,
                                                  255)
    assert err == skycoin.SKY_OK
    bh = skycoin.coin__BlockHeader()
    bh.Time = 0
    bh.BkSeq = 1
    t = []
    tc1 = testcase()
    t.append(tc1)
    tc2 = testcase()
    tc2.index = 10
    tc2.failure = skycoin.SKY_ERROR
    t.append(tc2)
    ux = skycoin.coin__UxOut()
    tests_count = len(t)
    for i in range(tests_count):
        err = skycoin.SKY_coin_CreateUnspent(bh, handle, t[i].index, ux)
        if t[i].failure == skycoin.SKY_ERROR:
            pass
        assert bh.Time == ux.Head.Time
        assert bh.BkSeq == ux.Head.BkSeq
Exemplo n.º 2
0
def test_TestCreateUnspents():
    err, pubkey, seckey, address = utils.makeKeysAndAddress()
    assert err == skycoin.SKY_OK
    hash1 = skycoin.cipher_SHA256()
    txn = utils.makeEmptyTransaction()
    err = skycoin.SKY_coin_Transaction_PushOutput(txn, address, int(11e6),
                                                  int(255))
    assert err == skycoin.SKY_OK
    bh = skycoin.coin__BlockHeader()
    bh.Time = 0
    bh.BkSeq = 1
    err, uxouts = skycoin.SKY_coin_CreateUnspents(bh, txn)
    assert err == skycoin.SKY_OK
    assert err == skycoin.SKY_OK
    assert len(uxouts) == 1