diff options
| author | Your Name <you@example.com> | 2026-05-19 13:21:25 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 13:31:08 +0530 |
| commit | eeba74a4a1c011e85e33dea4252b381e35a64ea4 (patch) | |
| tree | 14862e7d300511e28e214c743fd2f699bc54c5b8 /tests/unit/stubs/mint_health.h | |
| parent | b0d9d494f00ee77f9efc22d1ef2ea3c94b23ddbd (diff) | |
feat: multi-mint wallet with health tracking, WPA auto-detect, display gating
Squash merge of feature/multi-mint-support (21 commits):
Multi-mint wallet:
- Accept payments from 4 mints: minibits, coinos, 21mint, lnvoltz
- Periodic health probing (300s interval, 3 recovery threshold)
- Multi-wallet init with nucula_wallet_init_multi()
- /mints and /wallet API endpoints
WPA auto-detect:
- wifi_auth_mode config field (default WPA2, supports WPA3)
- Runtime mapping to wifi_auth_mode_t in STA config
Display gating:
- display_enabled config field (default true)
- Guards display_init/display_update per-board
Bug fixes:
- 3s delay before service start prevents lwip mem_free assertion
- Real npub in discovery (identity_get()->npub_hex)
- Health probe interval 300s (production value)
- Duplicate services_start_task call removed
- UTF-8 arrow replaced with ASCII in log message
Tests: 61+14 unit tests passing, firmware builds clean
Diffstat (limited to 'tests/unit/stubs/mint_health.h')
| -rw-r--r-- | tests/unit/stubs/mint_health.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/unit/stubs/mint_health.h b/tests/unit/stubs/mint_health.h new file mode 100644 index 0000000..7248042 --- /dev/null +++ b/tests/unit/stubs/mint_health.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #ifndef MINT_HEALTH_H | ||
| 2 | #define MINT_HEALTH_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdint.h> | ||
| 6 | |||
| 7 | #define MINT_HEALTH_MAX 8 | ||
| 8 | #define MINT_HEALTH_PROBE_INTERVAL_S 300 | ||
| 9 | #define MINT_HEALTH_PROBE_TIMEOUT_MS 15000 | ||
| 10 | #define MINT_HEALTH_RECOVERY_THRESHOLD 3 | ||
| 11 | |||
| 12 | typedef struct { | ||
| 13 | char url[256]; | ||
| 14 | bool reachable; | ||
| 15 | uint8_t consecutive_successes; | ||
| 16 | int64_t last_probe_ms; | ||
| 17 | int last_http_status; | ||
| 18 | } mint_status_t; | ||
| 19 | |||
| 20 | typedef void (*mint_health_changed_cb)(void); | ||
| 21 | |||
| 22 | static inline bool mint_health_is_reachable(const char *url) { | ||
| 23 | (void)url; | ||
| 24 | return true; | ||
| 25 | } | ||
| 26 | |||
| 27 | static inline void mint_health_mark_unreachable(const char *url) { | ||
| 28 | (void)url; | ||
| 29 | } | ||
| 30 | |||
| 31 | static inline esp_err_t mint_health_init(const char urls[][256], int count) { | ||
| 32 | (void)urls; (void)count; return 0; | ||
| 33 | } | ||
| 34 | |||
| 35 | static inline void mint_health_start(void) {} | ||
| 36 | static inline void mint_health_stop(void) {} | ||
| 37 | static inline const mint_status_t *mint_health_get_all(int *out_count) { | ||
| 38 | *out_count = 0; return NULL; | ||
| 39 | } | ||
| 40 | static inline void mint_health_register_callback(mint_health_changed_cb cb) { | ||
| 41 | (void)cb; | ||
| 42 | } | ||
| 43 | |||
| 44 | #endif | ||