From 757c2b93b04d6504cc3025df44f13afaa9b48294 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Mon, 5 Mar 2018 20:51:39 -0600 Subject: [PATCH] Removed leftovers, added back HEADERS_URL --- lib/bitcoin.py | 66 ------------ lib/blockchain.py | 2 +- lib/constants.py | 4 +- lib/servers-orig.json | 231 ------------------------------------------ 4 files changed, 3 insertions(+), 300 deletions(-) delete mode 100644 lib/servers-orig.json diff --git a/lib/bitcoin.py b/lib/bitcoin.py index d8c36728..aee77791 100644 --- a/lib/bitcoin.py +++ b/lib/bitcoin.py @@ -40,72 +40,6 @@ from . import segwit_addr from . import constants - - -''' TODO -# Version numbers for BIP32 extended keys -# standard: xprv, xpub -# segwit in p2sh: yprv, ypub -# native segwit: zprv, zpub -XPRV_HEADERS = { - 'standard': 0x0488ade4, - 'p2wpkh-p2sh': 0x049d7878, - 'p2wsh-p2sh': 0x295b005, - 'p2wpkh': 0x4b2430c, - 'p2wsh': 0x2aa7a99 -} -XPUB_HEADERS = { - 'standard': 0x0488b21e, - 'p2wpkh-p2sh': 0x049d7cb2, - 'p2wsh-p2sh': 0x295b43f, - 'p2wpkh': 0x4b24746, - 'p2wsh': 0x2aa7ed3 -} - - -class NetworkConstants: - - # https://github.com/z-classic/zclassic/blob/master/src/chainparams.cpp#L103 - @classmethod - def set_mainnet(cls): - cls.TESTNET = False - cls.WIF_PREFIX = 0x80 - cls.ADDRTYPE_P2PKH = [0x1C, 0xB8] - cls.ADDRTYPE_P2SH = [0x1C, 0xBD] - cls.ADDRTYPE_SHIELDED = [0x16, 0x9A] - cls.SEGWIT_HRP = "bc" #TODO zcl has no segwit - cls.GENESIS = "0007104ccda289427919efc39dc9e4d499804b7bebc22df55f8b834301260602" - cls.DEFAULT_PORTS = {'t': '50001', 's': '50002'} - cls.DEFAULT_SERVERS = read_json('servers.json', {}) - cls.CHECKPOINTS = read_json('checkpoints.json', []) - cls.EQUIHASH_N = 200 - cls.EQUIHASH_K = 9 - cls.HEADERS_URL = "http://headers.zcl-electrum.com/blockchain_headers" - - cls.CHUNK_SIZE = 200 - - # https://github.com/z-classic/zclassic/blob/master/src/chainparams.cpp#L234 - @classmethod - def set_testnet(cls): - cls.TESTNET = True - cls.WIF_PREFIX = 0xef - cls.ADDRTYPE_P2PKH = [0x1D, 0x25] - cls.ADDRTYPE_P2SH = [0x1C, 0xBA] - cls.ADDRTYPE_SHIELDED = [0x16, 0xB6] - cls.SEGWIT_HRP = "tb" #TODO zcl has no segwit - cls.GENESIS = "03e1c4bb705c871bf9bfda3e74b7f8f86bff267993c215a89d5795e3708e5e1f" - cls.DEFAULT_PORTS = {'t': '51001', 's': '51002'} - cls.DEFAULT_SERVERS = read_json('servers_testnet.json', {}) - cls.CHECKPOINTS = read_json('checkpoints_testnet.json', []) - cls.EQUIHASH_N = 200 - cls.EQUIHASH_K = 9 - - #cls.HEADERS_URL = "http://35.224.186.7/blockchain_headers" - - cls.CHUNK_SIZE = 200 - -NetworkConstants.set_mainnet() -''' ################################## transactions COINBASE_MATURITY = 100 diff --git a/lib/blockchain.py b/lib/blockchain.py index 784b56dd..81809c48 100644 --- a/lib/blockchain.py +++ b/lib/blockchain.py @@ -204,7 +204,7 @@ class Blockchain(util.PrintError): target = self.get_target(index-1) for i in range(num): raw_header = data[i*bitcoin.HEADER_SIZE:(i+1) * bitcoin.HEADER_SIZE] - header = deserialize_header(raw_header, index*NetworkConstants.CHUNK_SIZE + i) + header = deserialize_header(raw_header, index*constants.net.CHUNK_SIZE + i) self.verify_header(header, prev_hash, target) prev_hash = hash_header(header) diff --git a/lib/constants.py b/lib/constants.py index 6b93e04b..1d90ae3f 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -37,8 +37,6 @@ def read_json(filename, default): return r - - class BitcoinMainnet: TESTNET = False @@ -57,6 +55,8 @@ class BitcoinMainnet: CHUNK_SIZE = 200 + HEADERS_URL = "http://headers.zcl-electrum.com/blockchain_headers" + XPRV_HEADERS = { 'standard': 0x0488ade4, # xprv 'p2wpkh-p2sh': 0x049d7878, # yprv diff --git a/lib/servers-orig.json b/lib/servers-orig.json deleted file mode 100644 index 1f639858..00000000 --- a/lib/servers-orig.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "E-X.not.fyi": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "ELECTRUMX.not.fyi": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "ELEX01.blackpole.online": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "VPS.hsmiths.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "bitcoin.freedomnode.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "btc.smsys.me": { - "pruning": "-", - "s": "995", - "version": "1.1" - }, - "currentlane.lovebitco.in": { - "pruning": "-", - "t": "50001", - "version": "1.1" - }, - "daedalus.bauerj.eu": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "de01.hamster.science": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "ecdsa.net": { - "pruning": "-", - "s": "110", - "t": "50001", - "version": "1.1" - }, - "elec.luggs.co": { - "pruning": "-", - "s": "443", - "version": "1.1" - }, - "electrum.akinbo.org": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.antumbra.se": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.be": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.coinucopia.io": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.cutie.ga": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.festivaldelhumor.org": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.hsmiths.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.qtornado.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum.vom-stausee.de": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrum3.hachre.de": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrumx.bot.nu": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "electrumx.westeurope.cloudapp.azure.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "elx01.knas.systems": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "ex-btc.server-on.net": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "helicarrier.bauerj.eu": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "mooo.not.fyi": { - "pruning": "-", - "s": "50012", - "t": "50011", - "version": "1.1" - }, - "ndnd.selfhost.eu": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "node.arihanc.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "node.xbt.eu": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "node1.volatilevictory.com": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "noserver4u.de": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "qmebr.spdns.org": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "raspi.hsmiths.com": { - "pruning": "-", - "s": "51002", - "t": "51001", - "version": "1.1" - }, - "s2.noip.pl": { - "pruning": "-", - "s": "50102", - "version": "1.1" - }, - "s5.noip.pl": { - "pruning": "-", - "s": "50105", - "version": "1.1" - }, - "songbird.bauerj.eu": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "us.electrum.be": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - }, - "us01.hamster.science": { - "pruning": "-", - "s": "50002", - "t": "50001", - "version": "1.1" - } -}