is_known = False
# should not be necessary
- hist.sort(key=lambda tup: tup[1])
+ hist.sort(key=lambda tup: tup[2])
# check uniqueness too...
# add memory pool
address = params[1]
if password == self.config.get('server', 'password'):
self.watched_addresses.remove(address)
- print_log('unsubscribed', address)
+ # print_log('unsubscribed', address)
result = "ok"
else:
print_log('incorrect password')
tx_height = params[1]
result = self.get_merkle(tx_hash, tx_height)
except BaseException, e:
- error = str(e) + ': ' + tx_hash
- print_log("error:", error)
+ error = str(e) + ': ' + repr(params)
+ print_log("get_merkle error:", error)
elif method == 'blockchain.transaction.get':
try:
height = params[1]
result = self.bitcoind('getrawtransaction', [tx_hash, 0, height])
except BaseException, e:
- error = str(e) + ': ' + tx_hash
- print_log("error:", error)
+ error = str(e) + ': ' + repr(params)
+ print_log("tx get error:", error)
else:
error = "unknown method:%s" % method
return -1
if error:
- response = {'id': message_id, 'error': error}
+ self.push_response({'id': message_id, 'error': error})
elif result != '':
- response = {'id': message_id, 'result': result}
- self.push_response(response)
+ self.push_response({'id': message_id, 'result': result})
def watch_address(self, addr):
if addr not in self.watched_addresses:
def invalidate_cache(self, address):
with self.cache_lock:
- if 'address' in self.history_cache:
- print_log("cache: invalidating", address)
+ if address in self.history_cache:
+ # print_log("cache: invalidating", address)
self.history_cache.pop(address)
if address in self.watched_addresses: