Beispiel #1
0
 def __init__(self, tx):
     self.tx_hash = tx.hash().hex()
     inputs = []
     for txin in tx.txs_in:
         inputs.append(TransactionUtils.getTxinPublicAddressByPre(txin))
     self.tx_inputs = inputs
     outputs = []
     for txout in tx.txs_out:
         if TransactionUtils.isCFTransationOut(txout):
             txout_type = '众筹交易'
         else:
             txout_type = '普通交易'
         outputs.append([
             txout.address(), txout.coin_value, txout_type,
             TransactionUtils.getTransactionAndOutTime(txout),
             txout.usedState
         ])
     self.tx_outputs = outputs
     self.time = time.ctime(TransactionUtils.getTransactionAndOutTime(tx))
     self.total_coin = tx.total_in()
     self.fee = tx.fee()
     if TransactionUtils.isCFTransation(tx):
         self.tx_type = '众筹交易'
         self.lock_time = time.ctime(tx.cf_header.end_time)
         self.pre_hash = tx.cf_header.pre_hash.hex()
     else:
         self.tx_type = '普通交易'
     self.get_detail(tx)
Beispiel #2
0
def set_details_out_txs(tx_outs):
    for tx_out in tx_outs:
        tx_hash = TransactionOutDao.searchParentTransactionHash(tx_out)
        tx = TransactionDao.searchByHash(tx_hash)
        in_addr = []
        for tx_in in tx.txs_in:
            in_addr.append(TransactionUtils.getTxinPublicAddressByPre(tx_in))
        tx_out.in_addr = in_addr
        if TransactionUtils.isCFTransationOut(tx_out):
            txout_type = '众筹交易'
        else:
            txout_type = '普通交易'
        tx_out.type = txout_type
    return tx_outs