Esempio n. 1
0
 def get_all_tx_spent(self, addresses):
     seq = ','.join(['?'] * len(addresses))
     sql = 'SELECT b.tx_hash,sum(a.out_value) spent' \
           '  FROM outs a, ins b ' \
           '  WHERE a.tx_hash=b.prev_tx_hash and a.out_sn=b.prev_out_sn and a.out_address IN ({seq}) ' \
           '  GROUP BY a.tx_hash'.format(seq=seq)
     return execute_all(sql, addresses)
Esempio n. 2
0
 def get_unspend_outs(self, address):
     res = execute_all(
         'SELECT a.tx_hash,a.out_sn,a.out_script,a.out_value,a.out_address,b.block_no'
         '  FROM outs a, txs b'
         '  WHERE a.tx_hash=b.tx_hash'
         '    AND a.out_status=0 AND a.out_address=?', (address,))
     return res
Esempio n. 3
0
 def unfetch_tx(self):
     return set([e[0] for e in execute_all('SELECT tx_hash FROM txs WHERE tx_ver IS NULL ')])
Esempio n. 4
0
 def get_all_tx_receive(self, addresses):
     seq = ','.join(['?'] * len(addresses))
     sql = 'SELECT a.tx_hash,sum(a.out_value) receive' \
           '  FROM outs a ' \
           '  WHERE a.out_address IN ({seq}) GROUP BY a.tx_hash'.format(seq=seq)
     return execute_all(sql, addresses)
Esempio n. 5
0
 def unverify_tx_list(self):
     return set(execute_all('SELECT tx_hash,block_no FROM txs WHERE source=0'))
Esempio n. 6
0
 def get_all_txs(self, addresses):
     seq = ','.join(['?'] * len(addresses))
     sql = "SELECT b.tx_hash, ifnull(b.tx_time, strftime('%s', 'now')) tx_time " \
           "  FROM addresses_txs a,txs b " \
           "  WHERE a.tx_hash=b.tx_hash and a.address in ({seq}) ".format(seq=seq)
     return execute_all(sql, addresses)
Esempio n. 7
0
 def get_txs(self, address):
     return execute_all(
         "SELECT b.tx_hash, ifnull(b.tx_time, strftime('%s', 'now')) tx_time FROM addresses_txs a,txs b WHERE a.address=? AND a.tx_hash=b.tx_hash",
         (address,))