Skip to content

Answer electrum non-version openers and non-post http methods. - #1091

Merged
evoskuil merged 3 commits into
libbitcoin:masterfrom
eynhaender:fix/electrum-unanswered
Oct 29, 2026
Merged

evoskuil merged 3 commits into
libbitcoin:masterfrom
eynhaender:fix/electrum-unanswered

Conversation

@eynhaender

Copy link
Copy Markdown
Contributor

Two electrum requests were not answered while the connection was held:

  • A first request other than server.version (pre-1.6 opener) completed the
    handshake but was dropped. The opener is now kept on the channel and
    dispatched by protocol_electrum once attached (before resume), so it is
    answered with its id at the negotiated version.
  • Methods other than post (get, head, put, delete, trace, options, connect)
    had no subscriber. protocol_rpc now responds 405, once per request.

Tests: electrum__get__/electrum__options__ (405), and
electrum__server_version__non_version_opener__answered/_unknown__method_not_found;
existing opener tests now read the opener response first.

@evoskuil

Copy link
Copy Markdown
Member

Thanks, this fixes everything raised before. Re-dispatching the opener through the channel gives it a real gate, and the async ordering test proves it. OPTIONS now matches bitcoind, and start() is much simpler.

One remaining issue: the opener is normalized at version 0.0.

channel_electrum::dispatch runs electrum_request(...) on the request in place before the handshake, while version_ is still v0_0. The retained opener keeps that result. When it’s dispatched again at version_floor(protocol_minimum), the version-dependent normalization has already happened at the wrong version.

Concretely, below 1.1 blockchain.transaction.get drops its second parameter as the legacy height. At 1.1 and above, that parameter is verbose. So an opener of blockchain.transaction.get(txid, true) is answered with the raw tx instead of the verbose result.

Please don’t apply version-dependent normalization to a non-server.version message while the version is unset (v0_0). The opener is then normalized once, at the version it’s actually served at. A test with a verbose blockchain.transaction.get opener would cover it.

@eynhaender

Copy link
Copy Markdown
Contributor Author

Addressed in : electrum_request no longer applies version-dependent
normalization to a non-server.version message while the version is unset
(v0_0), so the opener is normalized once, at the version it is served at.

Added electrum__server_version__non_version_opener_verbose__expected
(verbose blockchain.transaction.get opener, 1.2 minimum suite), plus
electrum_request unit tests for the unset and 1.0 cases.

@evoskuil
evoskuil merged commit 8a03cba into libbitcoin:master Oct 29, 2026
15 checks passed
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.

2 participants