Page MenuHomePhabricator

[chronik] Electrum: add the server.features endpoint
ClosedPublic

Authored by Fabien on May 22 2025, 08:15.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABCee2771cbaed2: [chronik] Electrum: add the server.features endpoint
Summary

According to the protocol, this should return the public URLs and a list of the available protocols/ports in order to remain connected from other peers.
For now a single URL is supported, via a command line option as the node has no way to determine this value on its own.
In order to avoid querying the genesis hash for every call, the value is cached and a bridge function is added to get the hash from the node where it is hardcoded.

Test Plan
./test/functional/test_runner.py chronik_electrum_basic

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.May 22 2025, 08:15

Tail of the build log:

    Checking chronik-plugin-common v0.1.0 (/work/chronik/chronik-plugin-common)
    Checking postcard v1.1.1
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking url v2.5.4
    Checking chronik-plugin v0.1.0 (/work/chronik/chronik-plugin)
    Checking toml_datetime v0.6.8
    Checking serde_spanned v0.6.8
   Compiling pyo3 v0.23.3
    Checking sync_wrapper v0.1.2
    Checking mime v0.3.17
    Checking seahash v4.1.0
    Checking topo_sort v0.4.0
    Checking sync_wrapper v1.0.2
    Checking winnow v0.6.20
    Checking tower v0.5.1
    Checking hyper-util v0.1.10
    Checking axum-core v0.4.5
    Checking memoffset v0.9.1
    Checking tokio-tungstenite v0.24.0
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.31
    Checking serde_path_to_error v0.1.16
    Checking base64 v0.22.1
    Checking matchit v0.7.3
    Checking unindent v0.2.3
    Checking unicode-segmentation v1.12.0
    Checking futures v0.3.31
    Checking tower-http v0.5.2
   Compiling karyon_jsonrpc_macro v0.3.0
    Checking convert_case v0.6.0
   Compiling chronik-bridge v0.1.0 (/work/chronik/chronik-bridge)
    Checking toml_edit v0.22.22
   Compiling librocksdb-sys v0.11.0+8.1.1
    Checking axum v0.7.9
   Compiling pyo3-macros v0.23.3
    Checking toml v0.8.19
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling aws-lc-rs v1.13.1
   Compiling rustls v0.23.19
    Checking rustls-webpki v0.102.8
    Checking tokio-rustls v0.26.1
    Checking karyon_async_rustls v0.3.0
    Checking karyon_net v0.3.0
    Checking karyon_jsonrpc v0.3.0
    Checking rocksdb v0.21.0
    Checking chronik-db v0.1.0 (/work/chronik/chronik-db)
    Checking chronik-indexer v0.1.0 (/work/chronik/chronik-indexer)
    Checking chronik-http v0.1.0 (/work/chronik/chronik-http)
error: missing documentation for a constant
  --> chronik/chronik-http/src/electrum.rs:54:1
   |
54 | pub const ELECTRUM_PROTOCOL_MAX_VERSION: &str = "1.4.5";
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D missing-docs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(missing_docs)]`

error: could not compile `chronik-http` (lib) due to 1 previous error
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

Tail of the build log:

   Doc-tests chronik-bridge

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-http

running 1 test
test chronik/chronik-http/src/protobuf.rs - protobuf::Protobuf (line 29) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.39s

   Doc-tests chronik-indexer

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-common

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-plugin-impl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-proto

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests chronik-util

running 2 tests
test chronik/chronik-util/src/log.rs - log::log (line 65) ... ignored
test chronik/chronik-util/src/log.rs - log::log_chronik (line 87) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik-plugins failed with exit code 1
This revision is now accepted and ready to land.May 22 2025, 08:46
chronik/chronik-http/src/electrum.rs
54 ↗(On Diff #54116)

clippy wants a documentation