Merge pull request #124 from Idealcoder/master
Neaten up Zeroname-local
This commit is contained in:
commit
04a9f2e13a
1 changed files with 5 additions and 30 deletions
|
@ -19,16 +19,18 @@ def lookupDomain(domain):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
domain_object = rpc.name_show("d/"+domain)
|
domain_object = rpc.name_show("d/"+domain)
|
||||||
except:
|
except Exception, err:
|
||||||
#domain doesn't exist
|
#domain doesn't exist
|
||||||
|
print "Error looking up domain - does not exist %s %s" % (domain,err)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
domain_json = json.loads(domain_object['value'])
|
domain_json = json.loads(domain_object['value'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
domain_address = domain_json["zeronet"][subdomain]
|
domain_address = domain_json["zeronet"][subdomain]
|
||||||
except:
|
except Exception, err:
|
||||||
#domain exists but doesn't have any zeronet value
|
#domain exists but doesn't have any zeronet value
|
||||||
|
print "Error looking up domain - doesn't contain zeronet value %s %s" % (domain,err)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return domain_address
|
return domain_address
|
||||||
|
@ -52,30 +54,3 @@ rpc_pass = re.search("rpcpassword=(.*)$", namecoin_conf, re.M).group(1)
|
||||||
rpc_url = "http://%s:%s@127.0.0.1:8336" % (rpc_user, rpc_pass)
|
rpc_url = "http://%s:%s@127.0.0.1:8336" % (rpc_user, rpc_pass)
|
||||||
|
|
||||||
rpc = AuthServiceProxy(rpc_url, timeout=60*5)
|
rpc = AuthServiceProxy(rpc_url, timeout=60*5)
|
||||||
|
|
||||||
"""
|
|
||||||
while 1:
|
|
||||||
print "Waiting for new block",
|
|
||||||
sys.stdout.flush()
|
|
||||||
while 1:
|
|
||||||
try:
|
|
||||||
rpc = AuthServiceProxy(rpc_url, timeout=60*5)
|
|
||||||
if (int(rpc.getinfo()["blocks"]) > last_block): break
|
|
||||||
time.sleep(1)
|
|
||||||
rpc.waitforblock()
|
|
||||||
print "Found"
|
|
||||||
break # Block found
|
|
||||||
except socket.timeout: # Timeout
|
|
||||||
print ".",
|
|
||||||
sys.stdout.flush()
|
|
||||||
except Exception, err:
|
|
||||||
print "Exception", err.__class__, err
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
last_block = int(rpc.getinfo()["blocks"])
|
|
||||||
for block_id in range(config["lastprocessed"]+1, last_block+1):
|
|
||||||
processBlock(block_id)
|
|
||||||
|
|
||||||
config["lastprocessed"] = last_block
|
|
||||||
open(config_path, "w").write(json.dumps(config, indent=2))
|
|
||||||
"""
|
|
Loading…
Reference in a new issue