Commit graph

22 commits

Author SHA1 Message Date
fusion44
a921686b4a
fix(lightning): clear error for undecodable/wrong-network invoices
Decoding a malformed or wrong-network invoice (e.g. a regtest lnbcrt...
invoice on a mainnet node) made each backend fail with a cryptic,
leaked error: LND with the Go 'strconv.ParseUint: parsing "rt500":
invalid syntax' surfaced as a 500, and CLN with 'Invalid bolt11: ...'.

Add a shared helper raise_for_pay_req_decode_error() in lightning/utils
that recognizes the decode-failure signatures of both backends and
raises one clear 400 pointing at the likely cause (malformed or wrong
network). Wire LND (lnd_grpc), CLN gRPC and CLN JSON-RPC through it so
they behave identically; genuine backend errors still return 500.

Fixes #225

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 18:41:18 +02:00
fusion44
a98e9372b0
refactor(api): Event enum + broadcast_msg over WebSocket
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 18:41:18 +02:00
fusion44
4355c8eabd
fix(lightning): prevent shell injection in CLN local calls
Two authenticated code paths interpolated user-controlled input into a
shell command:

- decode_pay_request passed the bolt11 string into _make_local_call,
  which ran it via create_subprocess_shell; a crafted /lightning/
  decode-pay-req request could execute arbitrary commands. Switch
  _make_local_call to create_subprocess_exec with a discrete argv list.
- blitz_cln_unlock interpolated the wallet password into a
  cl.hsmtool.sh invocation run through a shell, and logged it in the
  clear. shlex.quote the interpolated values and mark the call
  sensitive=True.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 19:58:41 +02:00
fusion44
751687e60b chore: run ruff format and isort 2025-05-06 09:16:46 +02:00
fusion44
25e4be8441 feat: make config loading more flexible
If the environment variable BAPI_ENV_PATH is set, the config system will
try to read configs from the given path instead of .env in pwd

If no file is found .env in pwd will be used as a fallback

Env variables will always override settings in .env files.
2025-03-23 17:43:39 +01:00
fusion44
62d3f3da9b
fix: code changes for pydantic 2.4 2024-03-10 07:57:38 +01:00
fusion44
adf472ac8b feat: implement Ruff as a linter; fix given errors 2023-06-25 07:17:00 +02:00
fusion44
e290de8933
feat: proper error handling resolving peer aliases
Implementations sometimes don't find aliases in the gossip, even if
they are openeing a channel to the pubkey. In this case an empty
string will be returned and the problem logged in debug mode.

refs #199
2023-05-01 20:48:10 +02:00
fusion44
467d23a2c3
feat: improvements and fixes for send-coins
both:
feat: add send_all field to SendCoinsResponse

CLN_gRPC only:
feat: improve error handling
fix: return a status 412 when no funds are  available to send

CLN_gRPC only:
fix: send-coins sending incorrect amount
2023-05-01 13:28:58 +02:00
fusion44
909fac4702
fix: wrong wallet balance calculation (CLN j+gRPC)
Calculations didn't account for reserved utxo's and
where shown as available.
2023-04-09 18:21:20 +02:00
fusion44
3826fd93a0
fix: a few smaller bugs
- CLN-JRPC: short_channel_id is not available while a channel is
  confirming => return an empty string
- CLN-GRPC: don't send all=False with the amount flag when opening a
  channel as it'll lead to an erro
- CLN-GRPC: don't utf8-decode the open-channel result
2023-04-07 20:59:44 +02:00
fusion44
eca87a5019
feat: improve logging for lnd and cln grpc 2023-04-03 20:17:48 +02:00
fusion44
06d6779eeb
feat: improve error handling in CLN gRPC 2023-04-03 19:15:55 +02:00
fusion44
b3262c5a38
fix: increase gRPC max receive message size
refs #125
2023-04-03 18:49:48 +02:00
fusion44
bb0dcd69d2
feat: update CLN_GRPC where gRPC are available
refs #99
2023-03-13 21:51:38 +01:00
fusion44
c03cd6c5d1
feat: further improvements to logging 2023-03-13 18:22:34 +01:00
fusion44
39e7281ccc
fix: p2sh-segwit address deprecation for CLN
Core Lightning deprecated p2sh-segwit addresses which caused a crash
when a newer CLN was used than the gRPC files allowed.

932ca9e91f
2023-03-12 08:38:48 +01:00
fusion44
2435b1c57f
feat: improve logging and remove print statements 2022-12-18 20:55:48 +01:00
fusion44
f04e6aeb21
chore: update gRPC files for CLN v0.12.1 2022-12-01 19:08:29 +01:00
fusion44
86442dde89
feat: implement send all onchain funds flag
refs #139
2022-11-28 19:07:25 +01:00
fusion44
1388205ff5
feat: use CLN bookeeper plugin to serve onchain tx
closes #87, refs #99
2022-11-05 22:35:01 +01:00
fusion44
ba453e7bdb
refactor: switch to domain driven directory layout 2022-10-03 20:22:00 +02:00
Renamed from app/repositories/ln_impl/cln_grpc.py (Browse further)