Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter non liquid devices from create liquid wallet #1243

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/cryptoadvance/specter/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .key import Key
from .persistence import read_json_file, write_json_file
import logging
from .helpers import is_testnet
from .helpers import is_testnet, is_liquid

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -129,6 +129,8 @@ def key_types(self, network="main"):
return [key.key_type for key in self.keys if (key.is_testnet == test)]

def has_key_types(self, wallet_type, network="main"):
if is_liquid(network) and not self.liquid_support:
return False
if wallet_type == "multisig":
for key_type in self.key_types(network):
if key_type in ["", "sh-wsh", "wsh"]:
Expand All @@ -142,6 +144,8 @@ def has_key_types(self, wallet_type, network="main"):
def no_key_found_reason(self, wallet_type, network="main"):
if self.has_key_types(wallet_type, network=network):
return ""
if is_liquid(network) and not self.liquid_support:
return "This device type does not yet support Liquid"
reverse_network = "main" if is_testnet(network) else "test"
if wallet_type == "multisig":
for key_type in self.key_types(reverse_network):
Expand Down