Page MenuHomePhabricator

[chronik] implement electrum RPC method blockchain.scripthash.get_history
Needs RevisionPublic

Authored by PiRK on Fri, Feb 14, 09:02.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

See https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-methods.html#blockchain.scripthash.get_history

Notable difference between this implementation and Fulcrum:

  • we return an error if the history length is excessive, Fulcrum returns an empty history
  • we don't check if unconfirmed transactions have unconfirmed parents (Fulcrum would set a height of -1 in this case)
  • for now we don't implement Fulcrum's pagination parameters (from_height, to_height) (so we will need to return a version number < 1.5.1)

I do not expect we will ever use the pagination parameters, as specifying a block range does not allow to anticipate in advance the size of the returned history.

Test Plan

ninja check-functional

Event Timeline

PiRK requested review of this revision.Fri, Feb 14, 09:02

Tail of the build log:

    Checking karyon_core v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking url v2.5.4
    Checking tungstenite v0.24.0
   Compiling chronik-proto v0.1.0 (/work/chronik/chronik-proto)
    Checking toml_datetime v0.6.8
    Checking serde_spanned v0.6.8
   Compiling pyo3 v0.23.3
    Checking winnow v0.6.20
    Checking seahash v4.1.0
    Checking mime v0.3.17
    Checking sync_wrapper v1.0.2
    Checking topo_sort v0.4.0
    Checking sync_wrapper v0.1.2
    Checking tower v0.5.1
    Checking axum-core v0.4.5
    Checking tokio-tungstenite v0.24.0
    Checking hyper-util v0.1.10
    Checking memoffset v0.9.1
    Checking serde_urlencoded v0.7.1
    Checking futures-executor v0.3.31
    Checking serde_path_to_error v0.1.16
    Checking matchit v0.7.3
    Checking unindent v0.2.3
    Checking unicode-segmentation v1.12.0
   Compiling karyon_jsonrpc_macro v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking base64 v0.22.1
    Checking tower-http v0.5.2
    Checking futures v0.3.31
    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
    Checking toml v0.8.19
   Compiling pyo3-macros v0.23.3
    Checking chronik-plugin-impl v0.1.0 (/work/chronik/chronik-plugin-impl)
   Compiling aws-lc-rs v1.11.1
    Checking rustls-webpki v0.102.8
   Compiling rustls v0.23.19
    Checking tokio-rustls v0.26.1
    Checking karyon_async_rustls v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking karyon_net v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    Checking karyon_jsonrpc v0.2.1 (https://github.com/karyontech/karyon.git?rev=c019ca3273a89afb34e2aa429386851f45cfa5d1#c019ca32)
    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: this expression creates a reference which is immediately dereferenced by the compiler
   --> chronik/chronik-http/src/electrum.rs:890:42
    |
890 |                     let fee = get_tx_fee(&tx);
    |                                          ^^^ help: change this to: `tx`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`

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.38s

   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
Fabien requested changes to this revision.Fri, Feb 14, 15:41
Fabien added a subscriber: Fabien.
Fabien added inline comments.
electrum/electrumabc/synchronizer.py
308

remove

This revision now requires changes to proceed.Fri, Feb 14, 15:41