Browse Source

add simnet support (#4455)

3.2.x
Janus Troelsen 7 years ago
committed by ghost43
parent
commit
4f85615734
  1. 2
      electrum
  2. 1
      lib/commands.py
  3. 11
      lib/constants.py
  4. 3
      lib/simple_config.py

2
electrum

@ -401,6 +401,8 @@ if __name__ == '__main__':
constants.set_testnet() constants.set_testnet()
elif config.get('regtest'): elif config.get('regtest'):
constants.set_regtest() constants.set_regtest()
elif config.get('simnet'):
constants.set_simnet()
# run non-RPC commands separately # run non-RPC commands separately
if cmdname in ['create', 'restore']: if cmdname in ['create', 'restore']:

1
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("-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("--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("--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(): def get_parser():
# create main parser # create main parser

11
lib/constants.py

@ -101,9 +101,20 @@ class BitcoinRegtest(BitcoinTestnet):
CHECKPOINTS = [] 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) # don't import net directly, import the module instead (so that net is singleton)
net = BitcoinMainnet net = BitcoinMainnet
def set_simnet():
global net
net = BitcoinSimnet
def set_mainnet(): def set_mainnet():
global net global net

3
lib/simple_config.py

@ -113,6 +113,9 @@ class SimpleConfig(PrintError):
elif self.get('regtest'): elif self.get('regtest'):
path = os.path.join(path, 'regtest') path = os.path.join(path, 'regtest')
make_dir(path, allow_symlink=False) 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) self.print_error("electrum directory", path)
return path return path

Loading…
Cancel
Save