pycrypto dependency removed

This commit is contained in:
Joric 2011-07-13 21:38:02 +06:00
parent 7a4ec890b2
commit 30e4046540
2 changed files with 10 additions and 11 deletions

4
README
View File

@ -1,7 +1,3 @@
pywallet.py 1.0
based on http://github.com/gavinandresen/bitcointools
Usage: pywallet.py [options] Usage: pywallet.py [options]
Options: Options:

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# pywallet.py 1.1 # pywallet.py 1.0
# #
# based on http://github.com/gavinandresen/bitcointools # based on http://github.com/gavinandresen/bitcointools
# #
@ -27,9 +27,11 @@ import exceptions
import hashlib import hashlib
from ctypes import * from ctypes import *
max_version = 32400
addrtype = 0
json_db = {} json_db = {}
private_keys = [] private_keys = []
addrtype = 0
def determine_db_dir(): def determine_db_dir():
import os import os
@ -166,7 +168,6 @@ def ASecretToSecret(key):
return False return False
def importprivkey(db, key): def importprivkey(db, key):
vchSecret = ASecretToSecret(key) vchSecret = ASecretToSecret(key)
if not vchSecret: if not vchSecret:
@ -281,7 +282,7 @@ def create_env(db_dir=None):
return db_env return db_env
def parse_CAddress(vds): def parse_CAddress(vds):
d = {'ip':'0.0.0.0','port':0,'ntime': 0} d = {'ip':'0.0.0.0','port':0,'nTime': 0}
try: try:
d['nVersion'] = vds.read_int32() d['nVersion'] = vds.read_int32()
d['nTime'] = vds.read_uint32() d['nTime'] = vds.read_uint32()
@ -682,7 +683,11 @@ def main():
print json.dumps(json_db, sort_keys=True, indent=4) print json.dumps(json_db, sort_keys=True, indent=4)
elif options.key: elif options.key:
if (options.key not in private_keys): if json_db['version'] > max_version:
print "Version mismatch (must be <= %d)" % max_version
elif options.key in private_keys:
print "Already exists"
else:
db = open_wallet(db_env, writable=True) db = open_wallet(db_env, writable=True)
if importprivkey(db, options.key): if importprivkey(db, options.key):
@ -691,8 +696,6 @@ def main():
print "Bad private key" print "Bad private key"
db.close() db.close()
else:
print "Already exists"
if __name__ == '__main__': if __name__ == '__main__':
main() main()