def search(hash): c = CoinSqlite3()._exec_sql('Select * from BlockInfo where hash = ?', hash) tmp = c.fetchone() if tmp != None: txs = TransactionDao.search(hash) sort_txs = __sort_txs(txs) block = Block(tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7], sort_txs, tmp[8], tmp[9], tmp[10], tmp[0]) for tx in txs: tx.block = block return block
def searchAll(): c = CoinSqlite3()._exec_sql('Select * from BlockInfo') blocks = [] for tmp in c.fetchall(): txs = TransactionDao.search(tmp[1]) sort_txs = __sort_txs(txs) block = Block(tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7], sort_txs, tmp[8], tmp[9], tmp[10], tmp[0]) for tx in txs: tx.block = block blocks.append(block) return blocks