Exemplo n.º 1
0
 def read(cls, read):
     prev_hash = read(32)
     prev_idx = read_le_uint32(read)
     script_sig = Script(read_varbytes(read))
     sequence = read_le_uint32(read)
     kwargs = {'x_pubkeys': [], 'address': None, 'threshold': 0, 'signatures': []}
     if prev_hash != bytes(32):
         _parse_script_sig(script_sig.to_bytes(), kwargs)
     result = cls(prev_hash, prev_idx, script_sig, sequence, value=0, **kwargs)
     if not result.is_complete():
         result.value = read_le_int64(read)
     return result
Exemplo n.º 2
0
    def deserialize_version(cls, f):
        version = bitcoinx.read_le_int32(f.read)
        services = bitcoinx.read_le_uint64(f.read)
        timestamp = time.ctime(bitcoinx.read_le_int64(f.read))
        addr_recv = cls.deserialize_IPv4_addr_from_version(f)
        addr_from = cls.deserialize_IPv4_addr_from_version(f)
        nonce = bitcoinx.read_le_uint64(f.read)
        user_agent = bitcoinx.packing.read_varbytes(f.read)
        start_height = bitcoinx.read_le_int32(f.read)

        v = {'version': version,
             'services': services,
             'timestamp': timestamp,
             'addr_recv': addr_recv,
             'addr_from': addr_from,
             'nonce': nonce,
             'user_agent': user_agent,
             'start_height': start_height}
        return v