refactor: make running without LN explicit in .env

This commit is contained in:
fusion44 2022-06-04 14:16:19 +02:00
parent de9a96e621
commit 762b79fde2
No known key found for this signature in database
GPG key ID: 645FA807E935D9D5
4 changed files with 10 additions and 9 deletions

View file

@ -71,7 +71,7 @@ bitcoind_zmq_block_port_testnet=28332
bitcoind_user=raspibolt
bitcoind_pw=please_please_update_me_please
# lnd_grpc, cln_grpc
# lnd_grpc, cln_grpc, none
# Please refer to the documentation for the install procedure
# for each implementation.
ln_node=lnd_grpc

View file

@ -23,7 +23,7 @@ from app.models.lightning import (
from app.models.system import APIPlatform
from app.utils import SSE, lightning_config, redis_get, send_sse_message
if lightning_config.ln_node == "lnd":
if lightning_config.ln_node == "lnd_grpc":
import app.repositories.ln_impl.lnd_grpc as ln
elif lightning_config.ln_node == "cln_grpc":
import app.repositories.ln_impl.cln_grpc as ln

View file

@ -31,7 +31,7 @@ from app.utils import send_sse_message
def get_implementation_name() -> str:
return "LND"
return "LND_GRPC"
async def get_wallet_balance_impl() -> WalletBalance:
@ -94,9 +94,10 @@ async def list_all_tx_impl(
if p.payment_request in memo_cache:
comment = memo_cache[p.payment_request]
else:
pr = await decode_pay_request_impl(p.payment_request)
comment = pr.description
memo_cache[p.payment_request] = pr.description
if p.payment_request is not None and p.payment_request != "":
pr = await decode_pay_request_impl(p.payment_request)
comment = pr.description
memo_cache[p.payment_request] = pr.description
tx.append(GenericTx.from_lnd_grpc_payment(p, comment))
def sortKey(e: GenericTx):

View file

@ -18,7 +18,7 @@ from fastapi_plugins import redis_plugin
from starlette import status
node_type = config("ln_node")
if node_type == "lnd":
if node_type == "lnd_grpc":
import app.repositories.ln_impl.protos.lnd.lightning_pb2_grpc as lnrpc
import app.repositories.ln_impl.protos.lnd.router_pb2_grpc as routerrpc
import app.repositories.ln_impl.protos.lnd.walletunlocker_pb2_grpc as unlockerrpc
@ -104,12 +104,12 @@ class LightningConfig:
opts = (("grpc.ssl_target_name_override", "cln"),)
self._channel = grpc.aio.secure_channel(cln_grpc_url, creds, options=opts)
self.cln_stub = clnrpc.NodeStub(self._channel)
elif self.ln_node == "":
elif self.ln_node == "none":
# its ok to run raspiblitz also without lightning
pass
else:
raise NameError(
f'Node type "{self.ln_node}" is unknown. Use "lnd" or "clightning"'
f'Node type "{self.ln_node}" is unknown. Use "lnd_grpc" or "cln_grpc" or "none"'
)
def metadata_callback(self, context, callback):