Browse files

Logic update to mint_hashcash.py and mode change to verify_hashcash.py

I noticed that I could speed up the minting script by just adding if logic
to check of there are indeed any mails in the list. If not, move on. Also,
made a mode change to verify_hashcash.py, so it will actually execute. Heh.
  • Loading branch information...
1 parent bcf581d commit a3ea23bb801ec9286a1dc7e7adb3878544c7db8a @atoponce committed Apr 5, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 mint_hashcash.py
  2. 0 verify_hashcash.py
View
7 mint_hashcash.py
@@ -36,9 +36,10 @@
email_addrs.remove(list.split(":")[3])
# Call the hashcash function from the operating system to mint tokens
-for email in email_addrs:
- t = subprocess.Popen("hashcash -m %s -X -Z 2" % email, shell=True, stdout=subprocess.PIPE)
- tokens.append(t.stdout.read())
+if email_addrs:
+ for email in email_addrs:
+ t = subprocess.Popen("hashcash -m %s -X -Z 2" % email, shell=True, stdout=subprocess.PIPE)
+ tokens.append(t.stdout.read())
# Write the newly minted tokens to the header
f = fileinput.FileInput(sys.argv[1], inplace=1)
View
0 verify_hashcash.py 100644 → 100755
File mode changed.

0 comments on commit a3ea23b

Please sign in to comment.