refactor __init__ functions of Wallets (funding sources)

- better error messages when a conf variable is not provided
- unify approaches among different source files
This commit is contained in:
Pavol Rusnak
2024-01-22 10:06:22 -06:00
parent a3b7c76523
commit 824a8fa7c8
12 changed files with 131 additions and 69 deletions
+6 -2
View File
@@ -29,9 +29,13 @@ class CoreLightningWallet(Wallet):
__node_cls__ = CoreLightningNode
def __init__(self):
self.rpc = settings.corelightning_rpc or settings.clightning_rpc
self.ln = LightningRpc(self.rpc)
rpc = settings.corelightning_rpc or settings.clightning_rpc
if not rpc:
raise ValueError(
"cannot initialize CoreLightningWallet: missing corelightning_rpc"
)
self.ln = LightningRpc(rpc)
# check if description_hash is supported (from corelightning>=v0.11.0)
command = self.ln.help("invoice")["help"][0]["command"] # type: ignore
self.supports_description_hash = "deschashonly" in command