do not empty memorypool; tag transactions sent to electrum
[electrum-server.git] / backends / abe / __init__.py
index f5aa906..7c5ec6a 100644 (file)
@@ -10,7 +10,6 @@ from Queue import Queue
 import time, threading
 
 
-SQL_LIMIT=200
 
 class AbeStore(Datastore_class):
 
@@ -27,6 +26,8 @@ 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'))
 
@@ -151,9 +152,9 @@ class AbeStore(Datastore_class):
               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
 
@@ -169,9 +170,9 @@ class AbeStore(Datastore_class):
               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
 
@@ -194,9 +195,9 @@ class AbeStore(Datastore_class):
               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
 
@@ -211,9 +212,9 @@ class AbeStore(Datastore_class):
               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
 
@@ -456,14 +457,16 @@ class BlockchainProcessor(Processor):
                 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])