Ejemplo n.º 1
0
Archivo: tx.py Proyecto: shyba/torba
 def serialize(self):
     return b''.join(
         (pack_le_int32(self.version), pack_varint(len(self.inputs)),
          b''.join(tx_in.serialize() for tx_in in self.inputs),
          pack_varint(len(self.outputs)),
          b''.join(tx_out.serialize() for tx_out in self.outputs),
          pack_le_uint32(self.locktime)))
Ejemplo n.º 2
0
    async def make_raw_block(self, b):
        '''Construct a raw block'''

        header = await self.make_raw_header(b)

        transactions = []
        if b.get('height') > 0:
            transactions = await self.getrawtransactions(b.get('tx'), False)

        raw_block = header
        num_txs = len(transactions)
        if num_txs > 0:
            raw_block += pack_varint(num_txs)
            raw_block += b''.join(transactions)
        else:
            raw_block += b'\x00'

        return raw_block