ledger/btc.py
def _packetize_vout(tx_outs: Tuple[tx.TxOut, ...]) -> List[bytes]:
    '''Converts the output vector into apdu packets'''
    # first get the whole length-prefixed vector
    data_to_be_chunked = bytearray()
    data_to_be_chunked.extend(tx.VarInt(len(tx_outs)).to_bytes())
    for tx_out in tx_outs:
        data_to_be_chunked.extend(tx_out.to_bytes())

    # chunk it into 50 byte chunks
    chunks = [data_to_be_chunked[i:i + 50]  # chunk the data
              for i in range(0, len(data_to_be_chunked), 50)]

    # make continue packets for all but the last one
    packets = []
    packets.extend([_output_continue_packet(chunk) for chunk in chunks[:-1]])

    # the last one is a final packet
    packets.append(_output_final_packet(chunks[-1]))

    # return all the apdu packets
    return packets
Converts the output vector into apdu packets
Converts the output vector into apdu packets
Converts the output vector into apdu packets
def _packetize_vout(tx_outs: Tuple[tx.TxOut, ...]) -> List[bytes]:
    data_to_be_chunked = bytearray()
    data_to_be_chunked.extend(tx.VarInt(len(tx_outs)).to_bytes())
    for tx_out in tx_outs:
        data_to_be_chunked.extend(tx_out.to_bytes())
    chunks = [data_to_be_chunked[i:i + 50]  
              for i in range(0, len(data_to_be_chunked), 50)]
    packets = []
    packets.extend([_output_continue_packet(chunk) for chunk in chunks[:-1]])
    packets.append(_output_final_packet(chunks[-1]))
    return packets
def _packetize_vout ( tx_outs : Tuple [ tx . TxOut , ... ] ) -> List [ bytes ] : data_to_be_chunked = bytearray ( ) data_to_be_chunked . extend ( tx . VarInt ( len ( tx_outs ) ) . to_bytes ( ) ) for tx_out in tx_outs : data_to_be_chunked . extend ( tx_out . to_bytes ( ) ) chunks = [ data_to_be_chunked [ i : i + 50 ] for i in range ( 0 , len ( data_to_be_chunked ) , 50 ) ] packets = [ ] packets . extend ( [ _output_continue_packet ( chunk ) for chunk in chunks [ : - 1 ] ] ) packets . append ( _output_final_packet ( chunks [ - 1 ] ) ) return packets
Converts the output vector into apdu packets
Converts the output vector into apdu packets
'''Converts the output vector into apdu packets''' # first get the whole length-prefixed vector # chunk it into 50 byte chunks # chunk the data # make continue packets for all but the last one # the last one is a final packet # return all the apdu packets
tx_outs
Tuple[tx.TxOut, ...]