def deserialize_from(txbytes: bytes):
     ms = StreamManager.GetStream(txbytes)
     reader = BinaryReader(ms)
     tx = Transaction()
     tx.version = reader.read_uint8()
     tx.tx_type = reader.read_uint8()
     tx.nonce = reader.read_uint32()
     tx.gas_price = reader.read_uint64()
     tx.gas_limit = reader.read_uint64()
     tx.payer = reader.read_bytes(20)
     tx.payload = reader.read_var_bytes()
     attri_len = reader.read_var_int()
     if attri_len is 0:
         tx.attributes = bytearray()
     sigs_len = reader.read_var_int()
     tx.sigs = []
     for i in range(sigs_len):
         tx.sigs.append(Sig.deserialize(reader))
     return tx
Exemplo n.º 2
0
 def deserialize_from(bytes_tx: bytes):
     ms = StreamManager.get_stream(bytes_tx)
     reader = BinaryReader(ms)
     tx = Transaction()
     tx.version = reader.read_uint8()
     tx.tx_type = reader.read_uint8()
     tx.nonce = reader.read_uint32()
     tx.gas_price = reader.read_uint64()
     tx.gas_limit = reader.read_uint64()
     tx.payer = reader.read_bytes(20)
     tx.payload = reader.read_var_bytes()
     attribute_len = reader.read_var_int()
     if attribute_len is 0:
         tx.attributes = bytearray()
     sig_len = reader.read_var_int()
     tx.sig_list = list()
     for _ in range(0, sig_len):
         tx.sig_list.append(Sig.deserialize(reader))
     return tx