add headers url for testnet

This commit is contained in:
ThomasV 2017-01-07 18:39:41 +01:00
parent b4d5934da0
commit 4d41c36cbb
2 changed files with 4 additions and 4 deletions

View File

@ -42,6 +42,7 @@ ADDRTYPE_P2PKH = 0
ADDRTYPE_P2SH = 5 ADDRTYPE_P2SH = 5
XPRV_HEADER = "0488ade4" XPRV_HEADER = "0488ade4"
XPUB_HEADER = "0488b21e" XPUB_HEADER = "0488b21e"
HEADERS_URL = "https://headers.electrum.org/blockchain_headers"
def set_testnet(): def set_testnet():
global ADDRTYPE_P2PKH, ADDRTYPE_P2SH global ADDRTYPE_P2PKH, ADDRTYPE_P2SH
@ -52,6 +53,7 @@ def set_testnet():
ADDRTYPE_P2SH = 196 ADDRTYPE_P2SH = 196
XPRV_HEADER = "04358394" XPRV_HEADER = "04358394"
XPUB_HEADER = "043587cf" XPUB_HEADER = "043587cf"
HEADERS_URL = "https://headers.electrum.org/testnet_headers"
################################## transactions ################################## transactions

View File

@ -37,7 +37,6 @@ class Blockchain(util.PrintError):
def __init__(self, config, network): def __init__(self, config, network):
self.config = config self.config = config
self.network = network self.network = network
self.headers_url = "https://headers.electrum.org/blockchain_headers"
self.local_height = 0 self.local_height = 0
self.set_local_height() self.set_local_height()
@ -111,11 +110,10 @@ class Blockchain(util.PrintError):
if os.path.exists(filename): if os.path.exists(filename):
return return
try: try:
if bitcoin.TESTNET: raise
import urllib, socket import urllib, socket
socket.setdefaulttimeout(30) socket.setdefaulttimeout(30)
self.print_error("downloading ", self.headers_url) self.print_error("downloading ", bitcoin.HEADERS_URL)
urllib.urlretrieve(self.headers_url, filename + '.tmp') urllib.urlretrieve(bitcoin.HEADERS_URL, filename + '.tmp')
os.rename(filename + '.tmp', filename) os.rename(filename + '.tmp', filename)
self.print_error("done.") self.print_error("done.")
except Exception: except Exception: