Commit 4e79670
Changed files (2)
config.py
@@ -5,10 +5,10 @@ EMAIL = USERNAME+"@gitco.in"
#REMOTE_URI = "lvl1-k61vtf8e@stripe-ctf.com:level1"
REMOTE_URI = "lvl1-k61vtf8e@stripe-ctf.com:current-round"
REMOTE_BRANCH = 'origin/master'
-REPO_DIR = os.path.join(os.getcwd(), '.cache')#+os.urandom(4).encode('hex'))
+REPO_DIR = os.path.join(os.getcwd(), '.cache'+os.urandom(4).encode('hex'))
LEDGER_FILENAME = "LEDGER.txt"
LEDGER_PATH = os.path.join(REPO_DIR,LEDGER_FILENAME)
DIFFICULTY_FILENAME = "difficulty.txt"
DIFFICULTY_PATH = os.path.join(REPO_DIR,DIFFICULTY_FILENAME)
MESSAGE_LENGTH = 16
-GIT_POLL_INTERVAL = 45
+GIT_POLL_INTERVAL = 15
gitcoin.py
@@ -116,7 +116,7 @@ def gen_commit(repo, tree, username, email, time, message):
def proof_of_work(s, msg_len, difficulty, timeout):
# TODO: generalize and zmq this work out
"""return message, digest, success"""
- freq = 168384
+ freq = 168384*2
start = time.time()
worker_time = time.time()
count = 2
@@ -152,6 +152,7 @@ if __name__ == "__main__":
msg_len=MESSAGE_LENGTH)
while True:
+ # mining loop
message, digest, success = proof_of_work(s=s,
msg_len=MESSAGE_LENGTH,
difficulty=difficulty,
@@ -162,6 +163,7 @@ if __name__ == "__main__":
if success and not fastforward:
print("mined gitcoin! commit-hash:[%s]" % (message, digest),
file=sys.stderr)
+ break
elif fastforward:
# re-add our gitcoin to the reset --hard'd repository
difficulty = open(DIFFICULTY_PATH,"r").read().split()[0]
@@ -175,6 +177,7 @@ if __name__ == "__main__":
email=EMAIL,
time=commit_time,
msg_len=MESSAGE_LENGTH)
+ # end mining loop
c = gen_commit(repo=repo,
tree=tree,