Skip to content

Commit

Permalink
move liquid to production
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansnigirev committed Oct 26, 2021
1 parent ff3bd34 commit bb3e4af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/apps/wallets/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from app import BaseApp
import platform
from .manager import WalletManager
from .liquid.manager import LWalletManager
from helpers import is_liquid
import gc

Expand Down Expand Up @@ -32,7 +33,6 @@ def init(self, keystore, network, *args, **kwargs):
# switching the network - use different wallet managers for liquid or btc
if old_network is None or self.manager is None or is_liquid(old_network) != is_liquid(network):
if is_liquid(network):
from .liquid.manager import LWalletManager
self.manager = LWalletManager(self.root_path)
else:
self.manager = WalletManager(self.root_path)
Expand Down
47 changes: 11 additions & 36 deletions src/specter.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,26 +316,16 @@ async def settingsmenu(self):
return self.settingsmenu

async def select_network(self):
if not self.is_liquid_enabled:
buttons = [
(None, "Production"),
("main", "Mainnet"),
(None, "Testnets"),
("test", "Testnet"),
("signet", "Signet"),
("regtest", "Regtest"),
]
else:
buttons = [
(None, "Production"),
("main", "Bitcoin Mainnet"),
("liquidv1", "Liquid Mainnet"),
(None, "Testnets"),
("test", "Testnet"),
("signet", "Signet"),
("regtest", "Regtest"),
("elementsregtest", "Liquid Regtest"),
]
buttons = [
(None, "Production"),
("main", "Bitcoin Mainnet"),
("liquidv1", "Liquid Mainnet"),
(None, "Testnets"),
("test", "Testnet"),
("signet", "Signet"),
("regtest", "Regtest"),
("elementsregtest", "Liquid Regtest"),
]
# wait for menu selection
menuitem = await self.gui.menu(buttons, last=(255, None))
if menuitem != 255:
Expand Down Expand Up @@ -414,17 +404,9 @@ def save_settings(self, settings, fname=None):
key=self.keystore.settings_key
)

@property
def is_liquid_enabled(self):
return self.GLOBAL.get("experimental",{}).get("liquid", False)

async def experimental_settings(self):

controls = [{
"label": "Enable Liquid support",
"hint": "Two more networks are added:\nLiquid and Liquid Regtest",
"value": self.GLOBAL.get("experimental", {}).get("liquid", False)
}, {
"label": "Taproot",
"hint": "Taproot support only for single-key wallets\nwithout tap script trees",
"value": self.GLOBAL.get("experimental", {}).get("taproot", False)
Expand All @@ -440,23 +422,16 @@ async def experimental_settings(self):
res = await self.gui.show_screen()(scr)
if res is None:
return
liquid, taproot = res
taproot, *_ = res
# for now only experimental, can be extended
settings = {
"experimental": {
"liquid": liquid,
"taproot": taproot,
}
}
self.GLOBAL = settings
BaseApp.GLOBAL = settings
self.save_settings(settings)
if not self.is_liquid_enabled and is_liquid(self.network):
if self.network == "liquidv1":
self.set_network("main")
if self.network == "elementsregtest":
self.set_network("regtest")
await self.gui.alert("Network have changed!", "\n\nAs you disabled Liquid support\nwe switch current network to Bitcoin.")

async def update_devsettings(self):
buttons = [
Expand Down

0 comments on commit bb3e4af

Please sign in to comment.