예제 #1
0
 def add(self, tx: Transaction, block_number: int, timestamp: int):
     tm = qrlstateinfo_pb2.TransactionMetadata(transaction=tx.pbdata,
                                               block_number=block_number,
                                               timestamp=timestamp)
     tmp = self._data.tx_metadata[::-1]
     tmp.append(tm)
     del self._data.tx_metadata[:]
     self._data.tx_metadata.extend(tmp[-20:][::-1])
예제 #2
0
 def __init__(self, pbdata=None):
     self._data = pbdata
     if not pbdata:
         self._data = qrlstateinfo_pb2.TransactionMetadata()
예제 #3
0
 def deserialize(data):
     pbdata = qrlstateinfo_pb2.TransactionMetadata()
     pbdata.ParseFromString(bytes(data))
     return TransactionMetadata(pbdata)