Repository navigation
fix(electrum): serve server.features independently of peer discovery - #265
Open
HusseinAdeiza wants to merge 1 commit into
Open
HusseinAdeiza wants to merge 1 commit into
HusseinAdeiza wants to merge 1 commit into
Conversation
Collaborator
|
Thanks for opening this PR. This looks like a faithful port of mempool/electrs#150. One edge case shared with that implementation: Could we use the indexed block hash at height 0 instead? That would also handle configurable Elements regtest genesis blocks. A test asserting the actual genesis hash would catch this; the new test currently only checks that it’s a string and is disabled for Liquid. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #229
server.featureswas tied to peer discovery two ways: the dispatch arm is#[cfg(feature = "electrum-discovery")], and even inside gated builds the handler unwrapped the discovery manager and errored ("discovery is disabled", -32603) whenever the server was started without--electrum-public-hosts. Electrum >= 4.7.0 callsserver.featureson connect, so a default-feature electrs build with no public hosts is simply unreachable from the wallet (spesmilo/electrum#10281, reported in the issue).ServerFeaturesitself never needed discovery: the struct is already ungated, and all the data (hosts, version, genesis, protocol range) comes from the config. This builds the features once inRPC::start, hands every connection anArc<ServerFeatures>, and registers the method in every build. Discovery stays opt-in, exactly as before: it is still only started when public hosts are set, and the manager gets the same features value. Theelectrum_public_hostsconfig field loses its cfg gate so non-discovery builds can still report real hosts (parsed asNonethere, since the CLI flag lives in the gated block).This mirrors the fix mempool/electrs carries in PR 150 (merged upstream there on 2026-06-03).
Tests: new
test_electrum_server_features_without_public_hostsin tests/electrum.rs runs a raw TCPserver.featuresagainst the default harness config (hosts =None), same pattern astest_electrum_raw. On current master that request fails,-32603inside gated builds or unknown-method with--no-default-features; with the patch it returns the features object.cargo check --all-targetspasses with default features and with--no-default-features. The new integration test needs the electrsd harness to fetch bitcoind, which is heavy to provision locally; it will run in CI here, and I have the same command green locally if it finishes before review.