Fix: Add some simple limits to Electrum RPC by default#146
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces default resource limits for the Electrum RPC server (request line size, per-connection subscription count, and concurrent client connections) and wires them through configuration/launch scripts to reduce abuse and accidental overload.
Changes:
- Add new CLI/config options:
--electrum-max-line-size,--electrum-max-subscriptions,--electrum-max-clients. - Enforce per-connection subscription limits and a global max-client limit in the Electrum server.
- Update the
startscript to pass the new limits (with higher overrides for specific hosts/networks).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
start |
Passes new Electrum limit flags with defaults and host-based overrides. |
src/electrum/server.rs |
Implements max request line size enforcement, per-client subscription cap, and max concurrent client connections. |
src/config.rs |
Adds config fields and clap args/defaults for the new Electrum limits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mononaut
left a comment
There was a problem hiding this comment.
Tested ACK @ [60fb102]
I verified that the new limits are enforced as expected, but otherwise everything runs normally.
It would be good to update the README with the new config settings, but that can wait for a future PR once they've stabilized.
I wonder if the defaults should be set low or maybe a little higher.
Either way I have set fairly high limits for the start script.