Exemplo n.º 1
0
def go(G, s):
    try:
        while 1:
            # what are the per-txn size limits?
            pktlen = s.recv_exact(4)
            if not pktlen:
                break
            else:
                pktlen, = struct.unpack('>I', pktlen)
                packet = s.recv_exact(pktlen)
                data, size = decode(packet)
                assert size == pktlen
                [index, block_timestamp, raw_tx, lock_scripts] = data
                tx = TX()
                tx.unpack(raw_tx)
                result = True
                for i in range(len(tx.inputs)):
                    lock_script = lock_scripts[i]
                    try:
                        tx.verify(i, lock_script, block_timestamp)
                    except SystemError:
                        result = False
                pkt = encode((result, index))
                s.writev([struct.pack('>I', len(pkt)), pkt])
    except EOFError:
        pass
    coro.set_exit()
Exemplo n.º 2
0
def go (G, s):
    try:
        while 1:
            # what are the per-txn size limits?
            pktlen = s.recv_exact (4)
            if not pktlen:
                break
            else:
                pktlen, = struct.unpack ('>I', pktlen)
                packet = s.recv_exact (pktlen)
                data, size = decode (packet)
                assert size == pktlen
                [index, block_timestamp, raw_tx, lock_scripts] = data
                tx = TX()
                tx.unpack (raw_tx)
                result = True
                for i in range (len (tx.inputs)):
                    lock_script = lock_scripts[i]
                    try:
                        tx.verify (i, lock_script, block_timestamp)
                    except SystemError:
                        result = False
                pkt = encode ((result, index))
                s.writev ([struct.pack ('>I', len(pkt)), pkt])
    except EOFError:
        pass
    coro.set_exit()
Exemplo n.º 3
0
def test(lock_script, tx_raw, index, block_timestamp):
    tx = TX()
    tx.unpack(tx_raw)
    tx.verify(index, lock_script, block_timestamp)
Exemplo n.º 4
0
def test (lock_script, tx_raw, index, block_timestamp):
    tx = TX()
    tx.unpack (tx_raw)
    tx.verify (index, lock_script, block_timestamp)