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. """
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 = []
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):
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")
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')
])
]
-if os.path.exists("data/blockchain_headers"):
- data_files.append( (util.appdata_dir(), ["data/blockchain_headers"]) )
setup(name = "Electrum",
version = version.ELECTRUM_VERSION,