Open Kixunil opened 1 year ago
Describe the solution you'd like Cut out the RPC types from electrs to a separate crate that electrs will depend on and double check with the other crates to make sure they are usable on both sides. We could also have a
rust-electrum
organization to keep everything in one place.
Sounds great :)
One thing I realized is that while receivers would prefer String
or Cow<'de, str>
, senders might prefer &str
for performance. I guess Cow
is a sweet spot but maybe the types should be generic over storage instead?
This will also help a lot with #820. If separate crates are desired, do either of you think it would make sense to make electrs a Cargo workspace, so all these contributions can be put in one place? And if so, would you also be open to accepting a PR for a crate, electrum-http-proxy
?
This seems to be completely unrelated to #820 unless the HTTP API uses the same protocol just over HTTP instead of one line per request, in which case the types could be reused if they are specified to be the same. Note however that I don't see how notifications can be handled. Those need to be asynchronous, so probably requires websocket or http 2 or something.
Is your feature request related to a problem? Please describe. Looking at the electrum client crates, I'm a bit dissatisfied. The maintained one is sync-only, there's another unmaintained, undocumented one using
async
andhyper
(WTF?! electrum doesn't use HTTP!). I'm considering forking/making my own with this hierarchy of crates:electrum-rpc-types
- types representing messages that can be transferred over electrum json RPC (with serde derives)electrum-rpc-sync
- synchronous implementation using the types crateelectrum-rpc-async
- async implementation using the types crateThis improves code reuse. Postgres crates are organized similarly.
I'm wondering if it'd make sense to also share the types with electrs to improve reuse even more.
(Tangentially, I'm considering doing the same with
bitcoincore-rpc
because it's unmaintained.)Describe the solution you'd like Cut out the RPC types from electrs to a separate crate that electrs will depend on and double check with the other crates to make sure they are usable on both sides. We could also have a
rust-electrum
organization to keep everything in one place.Describe alternatives you've considered The only other solution I see is just not working together which may be a bunch of work.