예제 #1
0
파일: block.py 프로젝트: HUSTGOC/electrumq
 def get_block(self, block_no):
     b = execute_one('SELECT block_no, block_hash, block_root, block_ver, block_bits'
                     '  , block_nonce, block_time, block_prev, is_main '
                     '  FROM blocks WHERE block_no=? AND blocks.is_main=1', (block_no,))
     if b is None:
         return None
     block = BlockItem()
     block.block_no, block.block_hash, block.block_root, block.block_ver, block.block_bits \
         , block.block_nonce, block.block_time, block.block_prev, block.is_main = b
     return block
예제 #2
0
파일: block.py 프로젝트: HUSTGOC/electrumq
 def get_block_root(self, block_no):
     return execute_one(
         'SELECT block_root FROM blocks WHERE block_no=? AND blocks.is_main=1', (block_no,))[0]
예제 #3
0
 def get_max_tx_block(self, address):
     return execute_one(
         'SELECT ifnull(max(a.block_no),-1) FROM txs a, addresses_txs b WHERE b.address=? AND a.tx_hash=b.tx_hash',
         (address,))[0]
예제 #4
0
파일: block.py 프로젝트: HUSTGOC/electrumq
 def height(self):
     return execute_one('SELECT ifnull(max(block_no),-1) FROM blocks')[0]
예제 #5
0
 def get_balance(self, address):
     return execute_one(
         'SELECT ifnull(sum(out_value),0) FROM outs WHERE out_status=0 AND out_address=?',
         (address,))[0]