upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/unit/stubs
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-21 16:46:51 +0530
committerYour Name <you@example.com>2026-05-21 16:46:51 +0530
commit19e175b1c1dea54efb61e8040ffdfa973fbac5d5 (patch)
treef41ca977a993cc24f8bf136e96370c8097ceeaf1 /tests/unit/stubs
parent243e4808246555f86d464d1c476681a902e644ff (diff)
Wallet receive via health task queue (no separate TLS worker)
- Removed standalone TLS worker task (couldn't allocate 16KB internal stack) - Added wallet receive queue to mint_health task (already has 16KB stack + working TLS) - health_task processes wallet tokens between probe intervals (1s poll) - tls_worker_set_queue() registers queue from mint_health_start() - Fallback to synchronous receive if queue not available - Added freertos/queue.h and tollgate_api.h stubs for unit tests - Added BaseType_t/UBaseType_t/TickType_t/pdFALSE to FreeRTOS stub - Full payment round-trip confirmed: 2 payments → 41 sat balance
Diffstat (limited to 'tests/unit/stubs')
-rw-r--r--tests/unit/stubs/freertos/FreeRTOS.h5
-rw-r--r--tests/unit/stubs/freertos/queue.h37
-rw-r--r--tests/unit/stubs/tollgate_api.h11
3 files changed, 53 insertions, 0 deletions
diff --git a/tests/unit/stubs/freertos/FreeRTOS.h b/tests/unit/stubs/freertos/FreeRTOS.h
index 2d2b967..543d4e4 100644
--- a/tests/unit/stubs/freertos/FreeRTOS.h
+++ b/tests/unit/stubs/freertos/FreeRTOS.h
@@ -3,11 +3,16 @@
3 3
4#include <stdint.h> 4#include <stdint.h>
5 5
6typedef int32_t BaseType_t;
7typedef uint32_t UBaseType_t;
8typedef uint32_t TickType_t;
9
6static inline uint32_t xTaskGetTickCount(void) { return 0; } 10static inline uint32_t xTaskGetTickCount(void) { return 0; }
7static inline void vTaskDelay(uint32_t ticks) { (void)ticks; } 11static inline void vTaskDelay(uint32_t ticks) { (void)ticks; }
8#define pdMS_TO_TICKS(ms) ((ms) / 10) 12#define pdMS_TO_TICKS(ms) ((ms) / 10)
9#define portTICK_PERIOD_MS 10 13#define portTICK_PERIOD_MS 10
10#define portMAX_DELAY 0xFFFFFFFF 14#define portMAX_DELAY 0xFFFFFFFF
11#define pdTRUE 1 15#define pdTRUE 1
16#define pdFALSE 0
12 17
13#endif 18#endif
diff --git a/tests/unit/stubs/freertos/queue.h b/tests/unit/stubs/freertos/queue.h
new file mode 100644
index 0000000..04aef49
--- /dev/null
+++ b/tests/unit/stubs/freertos/queue.h
@@ -0,0 +1,37 @@
1#ifndef STUB_FREERTOS_QUEUE_H
2#define STUB_FREERTOS_QUEUE_H
3
4#include <stddef.h>
5#include "freertos/FreeRTOS.h"
6
7typedef void *QueueHandle_t;
8
9static inline QueueHandle_t xQueueCreate(UBaseType_t uxQueueLength, UBaseType_t uxItemSize)
10{
11 (void)uxQueueLength;
12 (void)uxItemSize;
13 return (QueueHandle_t)1;
14}
15
16static inline BaseType_t xQueueSend(QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait)
17{
18 (void)xQueue;
19 (void)pvItemToQueue;
20 (void)xTicksToWait;
21 return pdTRUE;
22}
23
24static inline BaseType_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait)
25{
26 (void)xQueue;
27 (void)pvBuffer;
28 (void)xTicksToWait;
29 return pdFALSE;
30}
31
32static inline void vQueueDelete(QueueHandle_t xQueue)
33{
34 (void)xQueue;
35}
36
37#endif
diff --git a/tests/unit/stubs/tollgate_api.h b/tests/unit/stubs/tollgate_api.h
new file mode 100644
index 0000000..7e20fce
--- /dev/null
+++ b/tests/unit/stubs/tollgate_api.h
@@ -0,0 +1,11 @@
1#ifndef STUB_TOLLGATE_API_H
2#define STUB_TOLLGATE_API_H
3
4#include "freertos/queue.h"
5
6static inline void tls_worker_set_queue(QueueHandle_t q)
7{
8 (void)q;
9}
10
11#endif