Browse Source

fix squattersStop reset on each new block

main
D4708 3 years ago
parent
commit
8dcd63ff37
  1. 8
      follower.py

8
follower.py

@ -30,6 +30,8 @@ serverUrl = "http://user:pwd@127.0.0.1:28332"
if len(sys.argv) > 1: if len(sys.argv) > 1:
serverUrl = sys.argv[1] serverUrl = sys.argv[1]
squattersStopCurrent = squattersStop
twister = AuthServiceProxy(serverUrl) twister = AuthServiceProxy(serverUrl)
try: try:
@ -53,7 +55,7 @@ if not dataLock:
block = twister.getblock(nextHash) block = twister.getblock(nextHash)
db.lastBlockHash = block["hash"] db.lastBlockHash = block["hash"]
if squattersStop < 0: if squattersStopCurrent < 0:
db.dataLock = False db.dataLock = False
break break
@ -65,10 +67,12 @@ if not dataLock:
print "read block", str(block["height"])# + "\r", print "read block", str(block["height"])# + "\r",
squattersStopCurrent = squattersStop
for u in block["usernames"]: for u in block["usernames"]:
print "follow", u print "follow", u
twister.follow(nodeUserName, [u]) twister.follow(nodeUserName, [u])
squattersStop = squattersStop - 1 squattersStopCurrent = squattersStopCurrent - 1
if block.has_key("nextblockhash"): if block.has_key("nextblockhash"):
nextHash = block["nextblockhash"] nextHash = block["nextblockhash"]
else: else:

Loading…
Cancel
Save