-
Notifications
You must be signed in to change notification settings - Fork 72
Implement Electrum Protocol v1.6 #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
9c09893 to
93c20f9
Compare
|
Hmm, |
|
Concept ACK |
93c20f9 to
114a3c1
Compare
41d0a5d to
accd03f
Compare
.. we just picked a random tcp-based server running Electrum X 1.19 with decent uptime from https://1209k.com/bitcoin-eye/ele.php.
17f66bc to
faeef85
Compare
|
Alright, now updated the CI to use a v1.6 server for tests, fixed some minor things that came up, and opted to simply drop the Undrafted, as this should be ready-to-go. |
0c9c373 to
e16260d
Compare
The local timeout test was introduce in f30be3b as a wait to check that connection timeouts work. However, it uses a pretty flaky setup to begin with, requiring manual `iptables` rules in CI, and it leans on a dummy server implementation that doesn't actually do anything besides accepting the connection. However, as with protocol v1.6 we now only consider the connection successful (and for now return the `Client`) if the counterparty responded to our version negotiation, we're now incompatible with the dummy setup of `test_local_timeout`. Since I'm not sure how solid and important the specific test coverage is to begin with, I here opted to just drop the test case.
Send `server.version` as the first message after establishing a connection, as required by Electrum protocol v1.6. The negotiated protocol version is stored in `RawClient` and can be retrieved via the new `protocol_version()` method. - Add `CLIENT_NAME`, `PROTOCOL_VERSION_MIN`, `PROTOCOL_VERSION_MAX` constants - Add `protocol_version` field to `RawClient` to store negotiated version - All constructors (`new`, `new_ssl`, `new_ssl_from_stream`, `new_proxy`) now automatically call `server.version` after connecting - The `server_version()` method also updates the stored version when called This is a breaking change as the constructors now return errors if protocol negotiation fails. Co-Authored-By: Claude Code AI Signed-off-by: Elias Rohrer <dev@tnull.de>
Add the `mempool.get_info` RPC method to the ElectrumApi trait. This method was added in protocol v1.6 and provides more detailed mempool fee information than the deprecated `blockchain.relayfee` method. The response includes: - `mempoolminfee`: Dynamic minimum fee rate for tx acceptance - `minrelaytxfee`: Static operator-configured minimum relay fee - `incrementalrelayfee`: Minimum fee rate increment for RBF/mempool limiting Co-Authored-By: Claude Code AI Signed-off-by: Elias Rohrer <dev@tnull.de>
Add support for the optional `mode` argument to `blockchain.estimatefee` which was added in protocol v1.6. The mode is passed to bitcoind's `estimatesmartfee` RPC as the `estimate_mode` parameter. - Add `EstimationMode` enum with `Conservative` and `Economical` variants - Update `estimate_fee` to take `Option<EstimationMode>` as second parameter - Update `Batch::estimate_fee` to support the mode parameter - `batch_estimate_fee` currently always uses `None` for mode This is a breaking change as the `estimate_fee` signature has changed. Co-Authored-By: Claude Code AI
…patibility Parse `blockchain.block.headers` response based on negotiated protocol version: - v1.6+: Headers returned as array of hex strings in `headers` field - v1.4 (legacy): Headers returned as concatenated hex in `hex` field - Add `is_protocol_version_at_least()` helper for semantic version comparison - Rename old response type to `GetHeadersResLegacy` (internal) - New `GetHeadersRes` handles v1.6 format with `header_hexes` field - Both formats produce the same public `headers: Vec<block::Header>` output Co-Authored-By: Claude Code AI
Add support for the `blockchain.transaction.broadcast_package` RPC method introduced in protocol v1.6 for package relay (CPFP) support. - Add `BroadcastPackageRes` and `BroadcastPackageError` types - Add `Param::StringVec` variant for array parameters - Add `transaction_broadcast_package_raw` trait method with generic `AsRef<[u8]>` - Add `transaction_broadcast_package` convenience method that serializes transactions Co-Authored-By: Claude Code AI Signed-off-by: Elias Rohrer <dev@tnull.de>
Add documentation note that `relay_fee` is deprecated in protocol v1.6 and users should use `mempool_get_info` instead. Co-Authored-By: Claude Code AI
Previously we'd then fail on the deserialization step, which is odd. Signed-off-by: Elias Rohrer <dev@tnull.de>
e16260d to
f689698
Compare
Closes #189.
I asked Claude Code to implement the changes necessary to update to the recently released Electrum Protocol v1.6.
Putting in draft for now until I got initial feedback (cc @oleonardolima @ValuedMammal). We also still need to change the test setup to a v1.6-compatible server to actually run the new tests against.