diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-10 00:11:20 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-10 00:11:20 +0000 |
| commit | ced6ef15a1e2ff4babd8a291f6d423846d986302 (patch) | |
| tree | a51554146164490213c5c241fd2f2ab4ba797ef4 /src/purgatory | |
| parent | bbdc68cd9a04cdabfa4a1fffd507048f555d5fa5 (diff) | |
fix: detect NIP-77 NOTICE immediately during negentropy sync
Previously, when a relay didn't support NIP-77, the negentropy_sync_diff
function would wait for the full client.sync() timeout even after receiving
a NOTICE message that marked the relay as not supporting NIP-77.
This change uses tokio::select! to race the sync operation against a
polling task that checks the nip77_supported flag every 10ms. When a NOTICE
is received (detected in the message handler), the poll task detects the
status change and immediately returns an error, allowing quick fallback to
REQ+EOSE without waiting for timeouts.
Benefits:
- Fast failure (within 10ms) when relay sends NIP-77 NOTICE
- No artificial timeout reduction that could hurt legitimate operations
- Maintains full timeout for relays that actually support NIP-77
Diffstat (limited to 'src/purgatory')
0 files changed, 0 insertions, 0 deletions