Browse Source

do not bundle blockchain headers with packages

283
thomasv 12 years ago
parent
commit
ba39f8bec0
  1. 25
      lib/verifier.py
  2. 9
      make_packages
  3. 2
      setup.py

25
lib/verifier.py

@ -43,9 +43,8 @@ class WalletVerifier(threading.Thread):
self.pending_headers = [] # headers that have not been verified self.pending_headers = [] # headers that have not been verified
self.height = 0 self.height = 0
self.local_height = 0 self.local_height = 0
self.init_headers_file()
self.set_local_height()
self.running = False self.running = False
self.headers_url = 'http://images.ecdsa.org/blockchain_headers'
def get_confirmations(self, tx): def get_confirmations(self, tx):
""" return the number of confirmations of a monitored transaction. """ """ return the number of confirmations of a monitored transaction. """
@ -81,6 +80,10 @@ class WalletVerifier(threading.Thread):
with self.lock: return self.running with self.lock: return self.running
def run(self): def run(self):
self.init_headers_file()
self.set_local_height()
with self.lock: with self.lock:
self.running = True self.running = True
requested_merkle = [] requested_merkle = []
@ -293,13 +296,17 @@ class WalletVerifier(threading.Thread):
filename = self.path() filename = self.path()
if os.path.exists(filename): if os.path.exists(filename):
return return
src = os.path.join(appdata_dir(), 'blockchain_headers') import urllib2
if os.path.exists(src): try:
# copy it from appdata dir print_error("downloading ", self.headers_url )
print_error( "copying headers to", filename ) f = urllib2.urlopen(self.headers_url)
shutil.copy(src, filename) s = f.read()
else: f.close()
print_error( "creating headers file", filename ) f = open(filename,'wb+')
f.write(s)
f.close()
except:
print_error( "download failed. creating file", filename )
open(filename,'wb+').close() open(filename,'wb+').close()
def save_chunk(self, index, chunk): def save_chunk(self, index, chunk):

9
make_packages

@ -9,10 +9,6 @@ if __name__ == '__main__':
print "aes and ecdsa are missing. copy them locally before." print "aes and ecdsa are missing. copy them locally before."
sys.exit() sys.exit()
if not os.path.exists('data/blockchain_headers'):
print "header file is missing"
sys.exit()
os.system("python mki18n.py") os.system("python mki18n.py")
os.system("pyrcc4 icons.qrc -o lib/icons_rc.py") os.system("pyrcc4 icons.qrc -o lib/icons_rc.py")
os.system("python setup.py sdist --format=zip,gztar") os.system("python setup.py sdist --format=zip,gztar")
@ -28,14 +24,13 @@ if __name__ == '__main__':
shutil.copytree("ecdsa",'dist/e4a-%s/ecdsa'%version) shutil.copytree("ecdsa",'dist/e4a-%s/ecdsa'%version)
shutil.copytree("aes",'dist/e4a-%s/aes'%version) shutil.copytree("aes",'dist/e4a-%s/aes'%version)
shutil.copytree("lib",'dist/e4a-%s/electrum'%version) shutil.copytree("lib",'dist/e4a-%s/electrum'%version)
shutil.copyfile("data/blockchain_headers",'dist/e4a-%s/blockchain_headers'%version)
os.chdir("dist" ) os.chdir("dist")
# create the zip file # create the zip file
os.system( "zip -r e4a-%s.zip e4a-%s"%(version, version) ) os.system( "zip -r e4a-%s.zip e4a-%s"%(version, version) )
# copy to a filename without extension # copy to a filename without extension
os.system( "cp e4a-%s.zip e4a"%version ) os.system( "cp e4a-%s.zip e4a"%version )
os.chdir(".." ) os.chdir("..")
md5_tgz = hashlib.md5(file('dist/'+_tgz, 'r').read()).digest().encode('hex') md5_tgz = hashlib.md5(file('dist/'+_tgz, 'r').read()).digest().encode('hex')
md5_zip = hashlib.md5(file('dist/'+_zip, 'r').read()).digest().encode('hex') md5_zip = hashlib.md5(file('dist/'+_zip, 'r').read()).digest().encode('hex')

2
setup.py

@ -37,8 +37,6 @@ data_files += [
]) ])
] ]
if os.path.exists("data/blockchain_headers"):
data_files.append( (util.appdata_dir(), ["data/blockchain_headers"]) )
setup(name = "Electrum", setup(name = "Electrum",
version = version.ELECTRUM_VERSION, version = version.ELECTRUM_VERSION,

Loading…
Cancel
Save