From dcc2c92bd6c9df4ba34bca8d9a41b590109e794e Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sat, 7 Jan 2017 18:47:20 +0900 Subject: [PATCH] Rename NETWORK envvar to NET For consistency with lib/coins.py SegWit testnet needs its own NET --- docs/ENVIRONMENT.rst | 10 +++++----- lib/coins.py | 2 ++ samples/systemd/electrumx.conf | 2 +- server/env.py | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/ENVIRONMENT.rst b/docs/ENVIRONMENT.rst index 8d9ff9c..5a46695 100644 --- a/docs/ENVIRONMENT.rst +++ b/docs/ENVIRONMENT.rst @@ -31,7 +31,7 @@ These environment variables are always required: The leading `http://` is optional, as is the trailing slash. The `:port` part is also optional and will default to the standard RPC - port for **COIN** and **NETWORK** if omitted. + port for **COIN** and **NET** if omitted. For the `run` script @@ -58,7 +58,7 @@ These environment variables are optional: Must be a *NAME* from one of the **Coin** classes in `lib/coins.py`_. Defaults to `Bitcoin`. -* **NETWORK** +* **NET** Must be a *NET* from one of the **Coin** classes in `lib/coins.py`_. Defaults to `mainnet`. @@ -77,7 +77,7 @@ These environment variables are optional: The maximum number of blocks to be able to handle in a chain reorganisation. ElectrumX retains some fairly compact undo information for this many blocks in levelDB. The default is a - function of **COIN** and **NETWORK**; for Bitcoin mainnet it is 200. + function of **COIN** and **NET**; for Bitcoin mainnet it is 200. * **HOST** @@ -98,7 +98,7 @@ These environment variables are optional: ElectrumX will listen on this port for local RPC connections. ElectrumX listens for RPC connections unless this is explicitly set - to blank. The default is appropriate for **COIN** and **NETWORK** + to blank. The default is appropriate for **COIN** and **NET** (e.g., 8000 for Bitcoin mainnet) if not set. * **DONATION_ADDRESS** @@ -223,7 +223,7 @@ connectivity on IRC: The nick to use when connecting to IRC. The default is a hash of **REPORT_HOST**. Either way a prefix will be prepended depending on - **COIN** and **NETWORK**. + **COIN** and **NET**. * **REPORT_HOST** diff --git a/lib/coins.py b/lib/coins.py index 9f7da80..9ad774e 100644 --- a/lib/coins.py +++ b/lib/coins.py @@ -301,6 +301,8 @@ class BitcoinTestnetSegWit(BitcoinTestnet): differently than with earlier versions. If you are using such a bitcoind on testnet, you must use this class as your "COIN". ''' + NET = "testnet-segwit" + @classmethod def deserializer(cls): return DeserializerSegWit diff --git a/samples/systemd/electrumx.conf b/samples/systemd/electrumx.conf index 0c9413f..c475301 100644 --- a/samples/systemd/electrumx.conf +++ b/samples/systemd/electrumx.conf @@ -42,7 +42,7 @@ #MISC # #COIN = Bitcoin # lib/coins.py - #NETWORK = mainnet # lib/coins.py + #NET = mainnet # lib/coins.py #DB_ENGINE = leveldb #leveldb, rocksdb, lmdb (You'll need to install appropriate python packages) diff --git a/server/env.py b/server/env.py index 4ce5c14..647078d 100644 --- a/server/env.py +++ b/server/env.py @@ -22,9 +22,9 @@ class Env(LoggedClass): def __init__(self): super().__init__() - self.obsolete(['UTXO_MB', 'HIST_MB']) + self.obsolete(['UTXO_MB', 'HIST_MB', 'NETWORK']) coin_name = self.default('COIN', 'Bitcoin') - network = self.default('NETWORK', 'mainnet') + network = self.default('NET', 'mainnet') self.coin = Coin.lookup_coin_class(coin_name, network) self.db_dir = self.required('DB_DIRECTORY') self.cache_MB = self.integer('CACHE_MB', 1200)