Merge pull request #2236 from kyuupichan/master
Add support for BU's nolnet
This commit is contained in:
commit
6977ba603b
4
electrum
4
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)
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue