electrum

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

commit 6977ba603bdaf8105155caca638b1f163d842e4c
parent 192238985e1c00655106fa802bd5f426d9c68448
Author: ThomasV <thomasv@electrum.org>
Date:   Mon,  6 Mar 2017 12:28:45 +0100

Merge pull request #2236 from kyuupichan/master

Add support for BU's nolnet
Diffstat:
Melectrum | 4++++
Mlib/bitcoin.py | 12++++++++++++
Mlib/blockchain.py | 2+-
Mlib/commands.py | 1+
Mlib/network.py | 11++++++++++-
Mlib/simple_config.py | 4+++-
6 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/electrum b/electrum @@ -360,6 +360,10 @@ if __name__ == '__main__': bitcoin.set_testnet() network.set_testnet() + if config.get('nolnet'): + bitcoin.set_nolnet() + network.set_nolnet() + # run non-RPC commands separately if cmdname in ['create', 'restore']: run_non_RPC(config) diff --git a/lib/bitcoin.py b/lib/bitcoin.py @@ -38,6 +38,7 @@ import pyaes # Bitcoin network constants TESTNET = False +NOLNET = False ADDRTYPE_P2PKH = 0 ADDRTYPE_P2SH = 5 ADDRTYPE_P2WPKH = 6 @@ -57,6 +58,17 @@ def set_testnet(): XPUB_HEADER = 0x043587cf HEADERS_URL = "https://headers.electrum.org/testnet_headers" +def set_nolnet(): + global ADDRTYPE_P2PKH, ADDRTYPE_P2SH, ADDRTYPE_P2WPKH + global XPRV_HEADER, XPUB_HEADER + global NOLNET, HEADERS_URL + NOLNET = True + ADDRTYPE_P2PKH = 0 + ADDRTYPE_P2SH = 5 + ADDRTYPE_P2WPKH = 6 + XPRV_HEADER = 0x0488ade4 + XPUB_HEADER = 0x0488b21e + HEADERS_URL = "https://headers.electrum.org/nolnet_headers" diff --git a/lib/blockchain.py b/lib/blockchain.py @@ -56,7 +56,7 @@ class Blockchain(util.PrintError): def verify_header(self, header, prev_header, bits, target): prev_hash = self.hash_header(prev_header) assert prev_hash == header.get('prev_block_hash'), "prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')) - if bitcoin.TESTNET: return + if bitcoin.TESTNET or bitcoin.NOLNET: return assert bits == header.get('bits'), "bits mismatch: %s vs %s" % (bits, header.get('bits')) _hash = self.hash_header(header) assert int('0x' + _hash, 16) <= target, "insufficient proof of work: %s vs target %s" % (int('0x' + _hash, 16), target) diff --git a/lib/commands.py b/lib/commands.py @@ -775,6 +775,7 @@ def add_global_options(parser): group.add_argument("-w", "--wallet", dest="wallet_path", help="wallet path") group.add_argument("--testnet", action="store_true", dest="testnet", default=False, help="Use Testnet") group.add_argument("--segwit", action="store_true", dest="segwit", default=False, help="The Wizard will create Segwit seed phrases (Testnet only).") + group.add_argument("--nolnet", action="store_true", dest="nolnet", default=False, help="Use Nolnet") def get_parser(): # create main parser diff --git a/lib/network.py b/lib/network.py @@ -68,7 +68,16 @@ def set_testnet(): DEFAULT_PORTS = {'t':'51001', 's':'51002'} DEFAULT_SERVERS = { '14.3.140.101': DEFAULT_PORTS, - 'testnet.not.fyi': DEFAULT_PORTS + 'testnet.hsmiths.com': {'t':'53011', 's':'53012'}, + 'electrum.akinbo.org': DEFAULT_PORTS, + 'ELEX05.blackpole.online': {'t':'52011', 's':'52002'}, + } + +def set_nolnet(): + global DEFAULT_PORTS, DEFAULT_SERVERS + DEFAULT_PORTS = {'t':'52001', 's':'52002'} + DEFAULT_SERVERS = { + '14.3.140.101': DEFAULT_PORTS, } NODES_RETRY_INTERVAL = 60 diff --git a/lib/simple_config.py b/lib/simple_config.py @@ -82,6 +82,8 @@ class SimpleConfig(PrintError): if self.get('testnet'): path = os.path.join(path, 'testnet') + elif self.get('nolnet'): + path = os.path.join(path, 'nolnet') # Make directory if it does not yet exist. if not os.path.exists(path): @@ -89,7 +91,7 @@ class SimpleConfig(PrintError): raise BaseException('Dangling link: ' + path) os.mkdir(path) - print_error("electrum directory", path) + self.print_error("electrum directory", path) return path def fixup_config_keys(self, config, keypairs):