# read pending requests from table cur.execute("SELECT address, amount, confirmations FROM electrum_payments WHERE paid IS NULL;") data = cur.fetchall() # add pending requests to the wallet for item in data: addr, amount, confirmations = item if addr in pending_requests: continue else: with wallet.lock: print "subscribing to %s" % addr pending_requests[addr] = {"requested": float(amount), "confirmations": int(confirmations)} wallet.synchronizer.subscribe_to_addresses([addr]) wallet.up_to_date = False try: cmd, params = out_queue.get(True, 10) except Queue.Empty: cmd = "" if cmd == "payment": addr = params # set paid=1 for received payments print "received payment from", addr cur.execute("update electrum_payments set paid=1 where address='%s'" % addr) elif cmd == "request": # add a new request to the table. addr, amount, confs, minutes = params
data = cur.fetchall() # add pending requests to the wallet for item in data: addr, amount, confirmations = item if addr in pending_requests: continue else: with wallet.lock: print "subscribing to %s" % addr pending_requests[addr] = { 'requested': float(amount), 'confirmations': int(confirmations) } wallet.synchronizer.subscribe_to_addresses([addr]) wallet.up_to_date = False try: cmd, params = out_queue.get(True, 10) except Queue.Empty: cmd = '' if cmd == 'payment': addr = params # set paid=1 for received payments print "received payment from", addr cur.execute( "update electrum_payments set paid=1 where address='%s'" % addr) elif cmd == 'request':