[BREAKGLASS] Append-only mirror of github.com/mempool/rust-electrum-client
Go to file
valued mammal 862280a882
Merge bitcoindevkit/rust-electrum-client#160: fix: fix batch ordering issue
a3488f4ff9 ci: bump actions/cache to v4 (valued mammal)
0ee0a6ad7a test: add batch response ordering test (marshallyale)
6721929f22 fix: fix batch ordering issue (marshallyale)

Pull request description:

  Fixes issue #75
  This is my first open source pull request so I apologize for any formatting issues. Additionally, I don't know the repository as well as others so there may be a better way to implement the fix.

  I believe I found the root cause of this. I added a pull request to fix, but I'm going to copy/paste what I believe is causing the error.

  The main issue in the code is inside raw_client.rs inside the `recv` method implementation (snippet below):
  805ea0af30/src/raw_client.rs (L671-L685)

  When this is first called, the `self._reader_thread` will run. Inside the `self._reader_thread`, if the request id matches the response id, everything works fine. However, if the request id does not match the response id, we run the following code:
  805ea0af30/src/raw_client.rs (L602-L612)

  The channel that the response is sent back into is not unique, but rather all the channels share the same sender.clone() and receiver. The only validation that is done is to check that the request id is still being searched for inside `self.waiting_map`. This means that the receiver channel receives whatever the next response is into the channel without any validation that it matches the request id which happens here `match receiver.recv()?`.

  This is fixed by implementing unique channels for every request id. This fix can be verified with the code johnzweng used to show the issue

  If you run this with the initial code, it will error out after 1-10 cycles normally. However, after the fix this runs indefinitely.

ACKs for top commit:
  ValuedMammal:
    reACK a3488f4ff9

Tree-SHA512: c56d572c0d9e709352fde0c0438103fe4c0338e4b591d5290468b1658d6d73dbc818044e1b7ea6307e449a8d4380d9deba6adf2b89eb1dcbc119cec277fd721c
2025-03-28 12:44:41 -04:00
.github/workflows ci: bump actions/cache to v4 2025-03-28 12:34:47 -04:00
examples timeout() and socks() don't return Result 2022-09-13 09:27:03 +02:00
src test: add batch response ordering test 2025-03-28 12:34:40 -04:00
.gitignore Release 0.1.0-beta.1 2020-02-06 18:15:22 +01:00
Cargo.toml chore: bump version to 0.23.0 2025-02-04 11:47:36 -05:00
CHANGELOG.md chore: bump version to 0.23.0 2025-02-04 11:47:36 -05:00
clippy.toml ci(msrv): bump rust MSRV to 1.75 2025-01-20 13:57:25 -03:00
LICENSE Initial commit 2020-02-06 17:54:27 +01:00
README.md ci(msrv): bump rust MSRV to 1.75 2025-01-20 13:57:25 -03:00

rust-electrum-client

Build Status Latest Version MSRV Badge

Bitcoin Electrum client library. Supports plaintext, TLS and Onion servers.

Minimum Supported Rust Version (MSRV)

This library should compile with any combination of features with Rust 1.75.0.