-from Abe.abe import hash_to_address, decode_check_address
+from Abe.util import hash_to_address, decode_check_address
from Abe.DataStore import DataStore as Datastore_class
from Abe import DataStore, readconf, BCDataStream, deserialize, util, base58
inrows = self.get_tx_inputs(txid, False)
for row in inrows:
_hash = self.binout(row[6])
+ if not _hash:
+ print "WARNING: missing tx_in for tx", txid
+ continue
+
address = hash_to_address(chr(0), _hash)
if self.tx_cache.has_key(address):
print "cache: invalidating", address
outrows = self.get_tx_outputs(txid, False)
for row in outrows:
_hash = self.binout(row[6])
+ if not _hash:
+ print "WARNING: missing tx_out for tx", txid
+ continue
+
address = hash_to_address(chr(0), _hash)
if self.tx_cache.has_key(address):
print "cache: invalidating", address
try:
if lock: self.dblock.acquire()
ret = self.selectall(sql,params)
- if lock: self.dblock.release()
- return ret
except:
print "sql error", sql
- return []
+ ret = []
+ finally:
+ if lock: self.dblock.release()
+
+ return ret
+
def get_tx_outputs(self, tx_id, lock=True):
return self.safe_sql("""SELECT
return block_number
+ def catch_up(store):
+ # if there is an exception, do rollback and then re-raise the exception
+ for dircfg in store.datadirs:
+ try:
+ store.catch_up_dir(dircfg)
+ except Exception, e:
+ store.log.exception("Failed to catch up %s", dircfg)
+ store.rollback()
+ raise e
+
+
+
+
from processor import Processor
class BlockchainProcessor(Processor):
if self.block_number != old_block_number:
old_block_number = self.block_number
+ print "block number:", self.block_number
self.push_response({ 'method':'blockchain.numblocks.subscribe', 'params':[self.block_number] })
while True: