commit 4f85615734e782c9ff4ab1c95a96ae22d6d0aa12
parent a141c69b25c1cf70639d0fceb8f5c57612588147
Author: Janus Troelsen <ysangkok@gmail.com>
Date: Fri, 22 Jun 2018 17:07:07 +0200
add simnet support (#4455)
Diffstat:
4 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/electrum b/electrum
@@ -401,6 +401,8 @@ if __name__ == '__main__':
constants.set_testnet()
elif config.get('regtest'):
constants.set_regtest()
+ elif config.get('simnet'):
+ constants.set_simnet()
# run non-RPC commands separately
if cmdname in ['create', 'restore']:
diff --git a/lib/commands.py b/lib/commands.py
@@ -835,6 +835,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("--regtest", action="store_true", dest="regtest", default=False, help="Use Regtest")
+ group.add_argument("--simnet", action="store_true", dest="simnet", default=False, help="Use Simnet")
def get_parser():
# create main parser
diff --git a/lib/constants.py b/lib/constants.py
@@ -101,9 +101,20 @@ class BitcoinRegtest(BitcoinTestnet):
CHECKPOINTS = []
+class BitcoinSimnet(BitcoinTestnet):
+
+ SEGWIT_HRP = "sb"
+ GENESIS = "683e86bd5c6d110d91b94b97137ba6bfe02dbbdb8e3dff722a669b5d69d77af6"
+ DEFAULT_SERVERS = read_json('servers_regtest.json', {})
+ CHECKPOINTS = []
+
+
# don't import net directly, import the module instead (so that net is singleton)
net = BitcoinMainnet
+def set_simnet():
+ global net
+ net = BitcoinSimnet
def set_mainnet():
global net
diff --git a/lib/simple_config.py b/lib/simple_config.py
@@ -113,6 +113,9 @@ class SimpleConfig(PrintError):
elif self.get('regtest'):
path = os.path.join(path, 'regtest')
make_dir(path, allow_symlink=False)
+ elif self.get('simnet'):
+ path = os.path.join(path, 'simnet')
+ make_dir(path, allow_symlink=False)
self.print_error("electrum directory", path)
return path