diff options
| author | Your Name <you@example.com> | 2026-05-17 04:37:15 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-17 04:37:15 +0530 |
| commit | cb4bd7d7c10cadcb43f82c09b13ffed744e541f7 (patch) | |
| tree | 1f01c31083e9252b7f41e89ba201373d6606a47d /main/tollgate_main.c | |
| parent | 78dd599277b8e8b2ddc39a4ae710ec91d737272e (diff) | |
Phase 5: Lightning auto-payout with LNURL-pay and NUT-05 melt
- New lnurl_pay.c/h: LNURL-pay protocol (GET .well-known/lnurlp + callback)
- New lightning_payout.c/h: threshold-based auto-payout with multi-recipient split
- Extended nucula_wallet bridge with nucula_wallet_melt() (NUT-05)
- Config: payout section with multi-mint, multi-recipient, fee_tolerance
- Default: enabled, TollGate@coinos.io, min_payout=128, min_balance=64
- 18 new unit tests (all passing), 134 total
Diffstat (limited to 'main/tollgate_main.c')
| -rw-r--r-- | main/tollgate_main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index d4dcf0d..3f83923 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include "nucula_wallet.h" | 20 | #include "nucula_wallet.h" |
| 21 | #include "wifistr.h" | 21 | #include "wifistr.h" |
| 22 | #include "tollgate_client.h" | 22 | #include "tollgate_client.h" |
| 23 | #include "lightning_payout.h" | ||
| 23 | 24 | ||
| 24 | #define MAX_STA_RETRY 5 | 25 | #define MAX_STA_RETRY 5 |
| 25 | static const char *TAG = "tollgate_main"; | 26 | static const char *TAG = "tollgate_main"; |
| @@ -89,6 +90,8 @@ static void ip_event_handler(void *arg, esp_event_base_t event_base, | |||
| 89 | const tollgate_config_t *cfg = tollgate_config_get(); | 90 | const tollgate_config_t *cfg = tollgate_config_get(); |
| 90 | nucula_wallet_init(cfg->mint_url); | 91 | nucula_wallet_init(cfg->mint_url); |
| 91 | 92 | ||
| 93 | lightning_payout_init(&cfg->payout); | ||
| 94 | |||
| 92 | char gw_ip_str[16]; | 95 | char gw_ip_str[16]; |
| 93 | snprintf(gw_ip_str, sizeof(gw_ip_str), IPSTR, IP2STR(&event->ip_info.gw)); | 96 | snprintf(gw_ip_str, sizeof(gw_ip_str), IPSTR, IP2STR(&event->ip_info.gw)); |
| 94 | tollgate_client_on_sta_connected(gw_ip_str); | 97 | tollgate_client_on_sta_connected(gw_ip_str); |
| @@ -282,5 +285,6 @@ void app_main(void) | |||
| 282 | vTaskDelay(pdMS_TO_TICKS(1000)); | 285 | vTaskDelay(pdMS_TO_TICKS(1000)); |
| 283 | session_tick(); | 286 | session_tick(); |
| 284 | tollgate_client_tick(); | 287 | tollgate_client_tick(); |
| 288 | lightning_payout_tick(); | ||
| 285 | } | 289 | } |
| 286 | } | 290 | } |