|
|
@ -13,6 +13,7 @@ import sys, cPickle |
|
|
|
|
|
|
|
|
|
|
|
dbFileName = "twisterDataGuard.pickle" |
|
|
|
dbFileName = "twisterDataGuard.pickle" |
|
|
|
nodeUserName = "twisterdataguard" |
|
|
|
nodeUserName = "twisterdataguard" |
|
|
|
|
|
|
|
blocksInStep = 10000 |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
from bitcoinrpc.authproxy import AuthServiceProxy |
|
|
|
from bitcoinrpc.authproxy import AuthServiceProxy |
|
|
@ -39,11 +40,17 @@ except: |
|
|
|
print "blockchain reading..." |
|
|
|
print "blockchain reading..." |
|
|
|
|
|
|
|
|
|
|
|
while True: |
|
|
|
while True: |
|
|
|
|
|
|
|
|
|
|
|
block = twister.getblock(nextHash) |
|
|
|
block = twister.getblock(nextHash) |
|
|
|
db.lastBlockHash = block["hash"] |
|
|
|
db.lastBlockHash = block["hash"] |
|
|
|
print "block", str(block["height"]) + "\r", |
|
|
|
|
|
|
|
usernames = block["usernames"] |
|
|
|
blocksInStep = blocksInStep - 1 |
|
|
|
for u in usernames: |
|
|
|
if blocksInStep < 0: |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "read block", str(block["height"]) + "\r", |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for u in block["usernames"]: |
|
|
|
print "follow", u |
|
|
|
print "follow", u |
|
|
|
twister.follow(nodeUserName, [u]) |
|
|
|
twister.follow(nodeUserName, [u]) |
|
|
|
if block.has_key("nextblockhash"): |
|
|
|
if block.has_key("nextblockhash"): |
|
|
|