import time, socket, operator, thread, ast, sys
import psycopg2, binascii
-import bitcoinrpc
+import bitcoin
from Abe.abe import hash_to_address, decode_check_address
from Abe.DataStore import DataStore as Datastore_class
def send_tx(tx):
- import bitcoinrpc
- conn = bitcoinrpc.connect_to_local()
+ import bitcoin
+ conn = bitcoin.connect_to_local()
try:
v = conn.importtransaction(tx)
except:
def memorypool_update(store):
- conn = bitcoinrpc.connect_to_local()
+ conn = bitcoin.connect_to_local()
try:
v = conn.getmemorypool()
except:
def clean_session_thread():
while not stopping:
- time.sleep(30)
+ time.sleep(3)
t = time.time()
for k,t0 in sessions_last_time.items():
if t - t0 > 60:
s.send('PONG '+line[1]+'\n')
elif '353' in line: # answer to /names
k = line.index('353')
- k2 = line.index('366')
+ try:
+ k2 = line.index('366')
+ except:
+ continue
for item in line[k+1:k2]:
if item[0:2] == 'E_':
s.send('USERHOST %s\n'%item)
elif '302' in line: # answer to /userhost
k = line.index('302')
- name = line[k+1]
+ name = line[k+2].split('=')[0]
host = line[k+2].split('@')[1]
peer_list[name] = host
elif time.time() - t > 5*60: