Use network config from config file to set paramas (#182)

This commit is contained in:
Jonathan Zernik 2020-07-31 03:06:10 -07:00 committed by GitHub
parent 5976623f74
commit 80713c94ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,7 @@
[DEFAULT]
[squeaknode]
network=simnet
price=1000
max_squeaks_per_address_per_hour=5
[lnd]
host=lnd
@ -19,10 +21,6 @@ rpc_pass=devpass
rpc_host=0.0.0.0
rpc_port=8774
[squeaknode]
price=1000
max_squeaks_per_address_per_hour=5
[admin]
rpc_host=0.0.0.0
rpc_port=8994

View file

@ -20,8 +20,8 @@ from tests.util import load_lightning_client
@pytest.fixture(autouse=True)
def select_mainnet_params():
# Set the network to mainnet.
SelectParams("mainnet")
# Set the network to simnet
SelectParams("simnet")
@pytest.fixture
def server_stub():

View file

@ -51,6 +51,10 @@ def load_admin_rpc_server(config, handler) -> SqueakAdminServerServicer:
)
def load_network(config):
return config["squeaknode"]["network"]
def load_price(config):
return int(config["squeaknode"]["price"])
@ -134,10 +138,6 @@ def main():
def run_server(config):
logger.info("network: " + config["DEFAULT"]["network"])
# SelectParams(config['DEFAULT']['network'])
SelectParams("mainnet")
# load the db params
db_params = load_db_params(config)
logger.info("db params: " + str(db_params))
@ -148,6 +148,11 @@ def run_server(config):
postgres_db.get_version()
postgres_db.init()
# load the price
network = load_network(config)
logger.info("network: " + network)
SelectParams(network)
# load the price
price = load_price(config)