-
Notifications
You must be signed in to change notification settings - Fork 70
Fix electrum tests: read full responses #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Davidson-Souza
merged 1 commit into
vinteumorg:master
from
JoseSK999:fix-electrum-tests
Jul 10, 2025
Merged
Fix electrum tests: read full responses #560
Davidson-Souza
merged 1 commit into
vinteumorg:master
from
JoseSK999:fix-electrum-tests
Jul 10, 2025
Conversation
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
We have been getting the `"EOF while parsing a string"` error occasionally in our electrum request tests. It seems that sometimes we don't read the full response from the TcpStream, likely because we read anything that is already on the stream without knowing if all the data is already there. So I am **trying** to fix it by reading a full line, until we reach a `\n`, which is the terminator used by electrum responses.
139191b to
e0d5e51
Compare
Davidson-Souza
approved these changes
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e0d5e51
Davidson-Souza
pushed a commit
to Davidson-Souza/Floresta
that referenced
this pull request
Jul 12, 2025
We have been getting the `"EOF while parsing a string"` error occasionally in our electrum request tests. It seems that sometimes we don't read the full response from the TcpStream, likely because we read anything that is already on the stream without knowing if all the data is already there. So I am **trying** to fix it by reading a full line, until we reach a `\n`, which is the terminator used by electrum responses.
18 tasks
Davidson-Souza
added a commit
that referenced
this pull request
Jul 13, 2025
* wire: don't spam the logs with `PeerNotFound` (#559) * running_node: call maybe_create_connection We are using `create_connection` directly, but this function assumes you've checked whether we are not connected with our `--connec` peer. If we don't check it, we will see the `PeerAlreadyExists` error over and over again. `maybe_create_connection` also helps using the fixed peers and dns seeds if we don't have any available addresses to work with Therefore, I'm replacing `create_connection` with `maybe_create_connection` for `check_connections`. * addr_man: don't return connected peers This will cause `node` to keep loggin `PeerAlreadyExists`, since it won't try to connect with the same peer twice. * Fix electrum tests: read full responses (#560) We have been getting the `"EOF while parsing a string"` error occasionally in our electrum request tests. It seems that sometimes we don't read the full response from the TcpStream, likely because we read anything that is already on the stream without knowing if all the data is already there. So I am **trying** to fix it by reading a full line, until we reach a `\n`, which is the terminator used by electrum responses. * Enable feature-gate banners in docs (#567) I have added `#![cfg_attr(docsrs, feature(doc_auto_cfg))]` to each lib.rs to enable such banners in our docs. To generate them we require the `--cfg docsrs` flag. I have updated our `just` recipe, which now documents all features. This is nice to show the users all options available under each feature. Because we document all features I had to do an exception for the florestad `kv-chainstore` one to avoid a compiler error. * fix: re-index didn't apply changes to chainstate (#562) Before this commit, the re-index code would find the right place where we would work from, but not apply it to our chain. This could create spurious errors like #551. This commit fixes that, and also improves how we handle accumulators on re-indexes. We now try to find our latest accumulator, move validation index there, nad mark future blocks as `HeadersOnly` to not have problems with `BlockDoesntExtendTip`. * chore: remove the `futures` crate (#564) When I started this project, we used async-std as async runtime. async-std did lack some features, like oneshot channes and some macros like select!, for that reason, I've used the futures crate to get some of those functionalities. However, since #172, we use tokio as async runtime. And tokio does have those features. So I'm removing futures as dependencies. tokio also has out-of-the-box support for ctr-c handling, so I'm using it instead of the crate. I've also made the public methods in florestad async. This simplifies some stuff, and shouldn't be a problem, since these methods should only be called with a running runtime. If you need to use them in a sync environment, use a thin wrapper that owns florestad and the runtime. Then block_on every call. * remove futures from floresta-electrum * remove futures and ctrc from florestad and wire * remove futures from floresta --------- Co-authored-by: S \times 3 🗿 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
What is the purpose of this pull request?
Which crates are being modified?
Description
We have been getting the
"EOF while parsing a string"error occasionally in our electrum request tests, as explained in #536.It seems that sometimes we don't read the full response from the TcpStream, likely because we read anything that is already on the stream, even if only a fraction of the message. So I am trying to fix it by reading a full line, until we reach a
\n(that is, until we've read the full response).EDIT: I have indeed found that the message that we read from electrum looks like this:
And that when we fail, the response we've read ends while at the headers hex, (i.e., we haven't finished reading the full response).
Fixes #536
Notes to the reviewers
An easy way to reproduce the error is to use a random, large number of headers to request, such that the electrum server takes a bit of time and our tests only read a partial response:
With such request at line 1200 I get the error on first or second try locally, but with this PR it passes.