Skip to content

feat!: Add Electrum protocol v1.6 method support#11

Open
evanlinjin wants to merge 5 commits intobitcoindevkit:masterfrom
evanlinjin:feature/electrum_protocol_v1_6
Open

feat!: Add Electrum protocol v1.6 method support#11
evanlinjin wants to merge 5 commits intobitcoindevkit:masterfrom
evanlinjin:feature/electrum_protocol_v1_6

Conversation

@evanlinjin
Copy link
Member

Summary

Add support for Electrum protocol v1.6 methods and response format changes.

  • ServerVersion request type for server.version (version negotiation)
  • EstimateFee gains an optional mode parameter ("ECONOMICAL", "CONSERVATIVE", etc.)
  • blockchain.block.headers responses now support both pre-1.6 (concatenated hex "hex" field) and v1.6 (list of hex strings "headers" field) formats
  • BroadcastPackage request type for blockchain.transaction.broadcast_package (package relay)
  • GetMempoolInfo request type for mempool.get_info (replaces blockchain.relayfee)
  • RelayFee deprecated in favor of GetMempoolInfo
  • Added missing Features to gen_pending_request_types! macro

Breaking changes

  • EstimateFee has a new mode: Option<CowStr> field
  • New enum variants in CompletedRequest / FailedRequest for the added request types

Test plan

  • cargo test passes
  • cargo clippy clean
  • cargo doc clean (no warnings)
  • Integration test against a v1.6 Electrum server

Closes #8

🤖 Generated with Claude Code

evanlinjin and others added 4 commits January 30, 2026 05:28
Eliminate the duplicated AsyncPendingRequest/BlockingPendingRequest
21-variant enums by replacing them with a single concrete PendingRequest
struct that uses a Box<dyn FnOnce> handler to type-erase the response
dispatch logic. This makes State non-generic, collapses
AsyncBatchRequest/BlockingBatchRequest into a single BatchRequest, and
removes all async/blocking-specific type aliases for response channels.

BatchRequest gains request_async() and request_blocking() convenience
methods that create channels internally and return receivers, so callers
no longer need to wire up channels manually.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ules

- Rename types: SatisfiedRequest → CompletedRequest, ErroredRequest → FailedRequest,
  RawNotificationOrResponse → RawIncoming, MaybeBatch → RawOneOrMany, State → RequestTracker
- Rename methods: process_incoming → handle_incoming, into_satisfied → into_completed,
  into_errored → into_failed
- Add request_async/request_blocking convenience methods to BatchRequest
- Remove dead BatchRequestError type
- Merge batch_request.rs into pending_request.rs
- Extract wire types from lib.rs into protocol.rs
- Remove Mutex from PendingRequest in favor of Send + Sync bounds

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Move async/blocking type aliases from lib.rs into the client module.
Delete 4 unused aliases (AsyncEventSender, AsyncRequestReceiver,
BlockingRequestReceiver, BlockingEventSender). Re-export only the
client structs and error types at the crate root.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add `ServerVersion` request type (`server.version`)
- Add optional `mode` parameter to `EstimateFee` (breaking: new field)
- Support both pre-1.6 (concatenated hex) and v1.6 (list of hex strings)
  response formats for `blockchain.block.headers`
- Add `BroadcastPackage` request type (`blockchain.transaction.broadcast_package`)
- Add `GetMempoolInfo` request type (`mempool.get_info`)
- Deprecate `RelayFee` in favor of `GetMempoolInfo`
- Add missing `Features` to `gen_pending_request_types!` macro

Closes bitcoindevkit#8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace EstimateFee mode Option<CowStr> with EstimateFeeMode enum
  (Conservative, Economical)
- Change BroadcastPackage to take Vec<bitcoin::Transaction> instead of
  Vec<String>, matching BroadcastTx's pattern of consensus-encoding
  internally

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update client to support Electrum protocol v1.6 methods

1 participant