import time, threading
-SQL_LIMIT=200
class AbeStore(Datastore_class):
Datastore_class.__init__(self,args)
+ self.sql_limit = int( config.get('database','limit') )
+
self.tx_cache = {}
self.bitcoind_url = 'http://%s:%s@%s:%s/' % ( config.get('bitcoind','user'), config.get('bitcoind','password'), config.get('bitcoind','host'), config.get('bitcoind','port'))
JOIN pubkey ON (pubkey.pubkey_id = prevout.pubkey_id)
WHERE pubkey.pubkey_hash = ?
AND cc.in_longest = 1
- LIMIT ? """, (dbhash,SQL_LIMIT))
+ LIMIT ? """, (dbhash,self.sql_limit))
- if len(out)==SQL_LIMIT:
+ if len(out)==self.sql_limit:
raise BaseException('limit reached')
return out
JOIN txout prevout ON (txin.txout_id = prevout.txout_id)
JOIN pubkey ON (pubkey.pubkey_id = prevout.pubkey_id)
WHERE pubkey.pubkey_hash = ?
- LIMIT ? """, (dbhash,SQL_LIMIT))
+ LIMIT ? """, (dbhash,self.sql_limit))
- if len(out)==SQL_LIMIT:
+ if len(out)==self.sql_limit:
raise BaseException('limit reached')
return out
JOIN pubkey ON (pubkey.pubkey_id = txout.pubkey_id)
WHERE pubkey.pubkey_hash = ?
AND cc.in_longest = 1
- LIMIT ? """, (dbhash,SQL_LIMIT))
+ LIMIT ? """, (dbhash,self.sql_limit))
- if len(out)==SQL_LIMIT:
+ if len(out)==self.sql_limit:
raise BaseException('limit reached')
return out
JOIN txout ON (txout.tx_id = tx.tx_id)
JOIN pubkey ON (pubkey.pubkey_id = txout.pubkey_id)
WHERE pubkey.pubkey_hash = ?
- LIMIT ? """, (dbhash,SQL_LIMIT))
+ LIMIT ? """, (dbhash,self.sql_limit))
- if len(out)==SQL_LIMIT:
+ if len(out)==self.sql_limit:
raise BaseException('limit reached')
return out
result = self.store.get_status(address)
self.watch_address(address)
except BaseException, e:
- error = str(e)
+ error = str(e) + ': ' + address
+ print "error:", error
elif method == 'blockchain.address.get_history':
try:
address = params[0]
result = self.store.get_history( address )
except BaseException, e:
- error = str(e)
+ error = str(e) + ': ' + address
+ print "error:", error
elif method == 'blockchain.transaction.broadcast':
txo = self.store.send_tx(params[0])