URI: 
       tadd regtest support (#4242) - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit b4d71e651b16a16afc427f87542b8fd9e05b66e3
   DIR parent b68f5645cbab180d0687b2b2e4f17adfe529191a
  HTML Author: fivepiece <fivepiece@users.noreply.github.com>
       Date:   Wed, 11 Apr 2018 20:10:14 +0300
       
       add regtest support (#4242)
       
       * add regtest support
       
       * set default regtest ssl and tcp ports to 51002 and 51002
       
       * regtest inherits parameters from testnet
       
       Diffstat:
         M electrum                            |       2 ++
         M lib/commands.py                     |       1 +
         M lib/constants.py                    |      13 +++++++++++++
         A lib/servers_regtest.json            |       8 ++++++++
         M lib/simple_config.py                |       3 +++
         M setup.py                            |       1 +
       
       6 files changed, 28 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/electrum b/electrum
       t@@ -401,6 +401,8 @@ if __name__ == '__main__':
        
            if config.get('testnet'):
                constants.set_testnet()
       +    elif config.get('regtest'):
       +        constants.set_regtest()
        
            # run non-RPC commands separately
            if cmdname in ['create', 'restore']:
   DIR diff --git a/lib/commands.py b/lib/commands.py
       t@@ -817,6 +817,7 @@ def add_global_options(parser):
            group.add_argument("-P", "--portable", action="store_true", dest="portable", default=False, help="Use local 'electrum_data' directory")
            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("--regtest", action="store_true", dest="regtest", default=False, help="Use Regtest")
        
        def get_parser():
            # create main parser
   DIR diff --git a/lib/constants.py b/lib/constants.py
       t@@ -93,6 +93,14 @@ class BitcoinTestnet:
            }
        
        
       +class BitcoinRegtest(BitcoinTestnet):
       +
       +    SEGWIT_HRP = "bcrt"
       +    GENESIS = "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"
       +    DEFAULT_SERVERS = read_json('servers_regtest.json', {})
       +    CHECKPOINTS = []
       +
       +
        # don't import net directly, import the module instead (so that net is singleton)
        net = BitcoinMainnet
        
       t@@ -105,3 +113,8 @@ def set_mainnet():
        def set_testnet():
            global net
            net = BitcoinTestnet
       +
       +
       +def set_regtest():
       +    global net
       +    net = BitcoinRegtest
   DIR diff --git a/lib/servers_regtest.json b/lib/servers_regtest.json
       t@@ -0,0 +1,8 @@
       +{
       +    "127.0.0.1": {
       +        "pruning": "-",
       +        "s": "51002",
       +        "t": "51001",
       +        "version": "1.2"
       +    }
       +}
   DIR diff --git a/lib/simple_config.py b/lib/simple_config.py
       t@@ -115,6 +115,9 @@ class SimpleConfig(PrintError):
                if self.get('testnet'):
                    path = os.path.join(path, 'testnet')
                    make_dir(path)
       +        elif self.get('regtest'):
       +            path = os.path.join(path, 'regtest')
       +            make_dir(path)
        
                self.print_error("electrum directory", path)
                return path
   DIR diff --git a/setup.py b/setup.py
       t@@ -74,6 +74,7 @@ setup(
                'electrum': [
                    'servers.json',
                    'servers_testnet.json',
       +            'servers_regtest.json',
                    'currencies.json',
                    'checkpoints.json',
                    'checkpoints_testnet.json',