def to_p2p(self):
    if self.use_witness:
        ret = P2PHeaderAndShortWitnessIDs()
    else:
        ret = P2PHeaderAndShortIDs()
    ret.header = self.header
    ret.nonce = self.nonce
    ret.shortids_length = len(self.shortids)
    ret.shortids = self.shortids
    ret.prefilled_txn_length = len(self.prefilled_txn)
    ret.prefilled_txn = []
    last_index = (- 1)
    for x in self.prefilled_txn:
        ret.prefilled_txn.append(PrefilledTransaction(((x.index - last_index) - 1), x.tx))
        last_index = x.index
    return ret
def to_p2p(self):
    if self.use_witness:
        ret = P2PHeaderAndShortWitnessIDs()
    else:
        ret = P2PHeaderAndShortIDs()
    ret.header = self.header
    ret.nonce = self.nonce
    ret.shortids_length = len(self.shortids)
    ret.shortids = self.shortids
    ret.prefilled_txn_length = len(self.prefilled_txn)
    ret.prefilled_txn = []
    last_index = (- 1)
    for x in self.prefilled_txn:
        ret.prefilled_txn.append(PrefilledTransaction(((x.index - last_index) - 1), x.tx))
        last_index = x.index
    return ret