Rework the ElectrumClient transport to cut latency and allocations
during sync:
- Channel-based single-reader write loop: drains the whole queue into a
single WriteAsync+FlushAsync, replacing the _writeLock that forced one
flush per message. N queued requests now travel in one TCP segment.
- PipeReader read loop parsing via Utf8JsonReader over pooled spans: no
StreamReader/ReadLineAsync and no intermediate string per response.
- TcpClient.NoDelay = true: no Nagle wait on small packets.
- Concurrency gate (SemaphoreSlim, MaxInFlight=32) in RequestAsync:
caps requests in flight to the server without serializing writes,
avoiding floods (-101/-102) and connection drops on wallets with large
history.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>