Files
LightningTipBot/internal/api/lightning_test.go
MichilisandClaude Sonnet 5.5 7f49e422f4 Fix the low-severity audit findings
- price map: guard with a RWMutex (fatal concurrent map access)
- InvoiceStream: stop on client disconnect, unsubscribe once, cap streams per wallet
- join tickets: key the ticket event per joiner; enforce tickets that
  expired while the bot was down

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 18:22:52 +00:00

22 lines
452 B
Go

package api
import "testing"
func TestStreamSlotsAreBoundedPerWallet(t *testing.T) {
for i := 0; i < maxStreamsPerWallet; i++ {
if !acquireStream("w1") {
t.Fatalf("slot %d refused", i)
}
}
if acquireStream("w1") {
t.Error("slot beyond the limit was granted")
}
if !acquireStream("w2") {
t.Error("another wallet must not be affected")
}
releaseStream("w1")
if !acquireStream("w1") {
t.Error("released slot was not reusable")
}
}