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
d5a568da3e
fix(lightning): include payments in CLN list_all_tx
Two bugs in the CLN JSON-RPC list_all_tx:
- 'if pay is not Payment' compared each item to the Payment class rather
  than its type, so it was always true and every payment was skipped -
  payments never showed up in the transaction list.
- the successful_only filter appended the item inside the match branch
  and then again unconditionally, so it never filtered anything.

Use isinstance for the type check and skip non-matching items when
successful_only is set. Also guard the source lists against None so a
failed sub-query no longer crashes the loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:45:21 +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
b7e9ae29fb
fix: adapt code to recent dependeny upgrades 2024-02-24 15:30:32 +01:00
fusion44
adf472ac8b feat: implement Ruff as a linter; fix given errors 2023-06-25 07:17:00 +02:00
fusion44
9f8631c581
fix: send_coins crash when calling CLN RPC 2023-05-01 20:49:52 +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
71ad84e704
feat: improve logging and error handling 2023-04-21 22:58:29 +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
57a3718a18
fix: CLN JRPC crash and initialization improvement
- fix: Crash in send-coins incorrectly assigning a value to a variable
- improvement: Robustness of the init code. Better detect a invalid
               RPC file path
2023-04-08 20:30:14 +02:00
fusion44
b8810d2204
feat: bolt11 cache as a function in CLN JSON-RPC 2023-04-02 20:23:27 +02:00
fusion44
b4fe14de33
fix: open channel key error 2023-04-02 20:23:10 +02:00
fusion44
60bb7e519f
feat: check pay status before attempting payment
CLN returns no error when a payment was already completed before.
This commit adds a check to the payment status before attempting to
complete the payment. If the payment was already completed, the API
returns an exception.
2023-04-02 16:50:33 +02:00
fusion44
114b76c3d2
feat: implement close channel in CLN JSON-RPC 2023-04-02 14:48:35 +02:00
fusion44
c73b8e9f15
feat: improve error detection in CLN JSON RPC 2023-04-02 12:57:27 +02:00
fusion44
eda5b3b17e
feat: implement listen forwards for CLN JSON RPC 2023-04-02 12:53:03 +02:00
fusion44
98b5912b23
feat: improve logging and error handling
* SSE client warmup data now logs errors properly
* apps module now logs errors properly
2023-04-02 11:09:43 +02:00
fusion44
572804033b
fix: increase buffer size for the socket reader 2023-03-30 19:41:32 +02:00
fusion44
507a32e372
feat: implement listen invoices in CLN JSON-RPC 2023-03-29 20:38:35 +02:00
fusion44
94179cc5da
feat: add CLN JSON-RPC implementation 2023-03-26 20:53:50 +02:00