electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ba39f8bec059f861e15ac002c28581a1bbc44d20
parent 2e8281d21cd5ac476b35b03ffcbc41dbe58051b7
Author: thomasv <thomasv@gitorious>
Date:   Mon, 17 Dec 2012 11:18:49 +0100

do not bundle blockchain headers with packages

Diffstat:
Mlib/verifier.py | 25++++++++++++++++---------
Mmake_packages | 9++-------
Msetup.py | 2--
3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/verifier.py b/lib/verifier.py @@ -43,9 +43,8 @@ class WalletVerifier(threading.Thread): self.pending_headers = [] # headers that have not been verified self.height = 0 self.local_height = 0 - self.init_headers_file() - self.set_local_height() self.running = False + self.headers_url = 'http://images.ecdsa.org/blockchain_headers' def get_confirmations(self, tx): """ return the number of confirmations of a monitored transaction. """ @@ -81,6 +80,10 @@ class WalletVerifier(threading.Thread): with self.lock: return self.running def run(self): + + self.init_headers_file() + self.set_local_height() + with self.lock: self.running = True requested_merkle = [] @@ -293,13 +296,17 @@ class WalletVerifier(threading.Thread): filename = self.path() if os.path.exists(filename): return - src = os.path.join(appdata_dir(), 'blockchain_headers') - if os.path.exists(src): - # copy it from appdata dir - print_error( "copying headers to", filename ) - shutil.copy(src, filename) - else: - print_error( "creating headers file", filename ) + import urllib2 + try: + print_error("downloading ", self.headers_url ) + f = urllib2.urlopen(self.headers_url) + s = f.read() + f.close() + f = open(filename,'wb+') + f.write(s) + f.close() + except: + print_error( "download failed. creating file", filename ) open(filename,'wb+').close() def save_chunk(self, index, chunk): diff --git a/make_packages b/make_packages @@ -9,10 +9,6 @@ if __name__ == '__main__': print "aes and ecdsa are missing. copy them locally before." sys.exit() - if not os.path.exists('data/blockchain_headers'): - print "header file is missing" - sys.exit() - os.system("python mki18n.py") os.system("pyrcc4 icons.qrc -o lib/icons_rc.py") 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("aes",'dist/e4a-%s/aes'%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 os.system( "zip -r e4a-%s.zip e4a-%s"%(version, version) ) # copy to a filename without extension 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_zip = hashlib.md5(file('dist/'+_zip, 'r').read()).digest().encode('hex') diff --git a/setup.py b/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", version = version.ELECTRUM_VERSION,