Skip to content

fix: return a consistent stop_height value#6

Merged
rustaceanrob merged 2 commits into
2140-dev:masterfrom
JoseSK999:fix-stop-height
Mar 10, 2026
Merged

fix: return a consistent stop_height value#6
rustaceanrob merged 2 commits into
2140-dev:masterfrom
JoseSK999:fix-stop-height

Conversation

@JoseSK999
Copy link
Copy Markdown
Contributor

If we use take_indices we remove the BTreeMap key/value pairs, so at the end stop_height will return 0, rather than the actual stop height. Or we may process the highest block before the others, so the stop_height value would jump down to the next highest block.

This method should instead return a consistent stop height value. My Floresta implementation was unable to finish SwiftSync due to this unexpected behavior.

@JoseSK999
Copy link
Copy Markdown
Contributor Author

Successfully ran cargo check/test/clippy locally (since this is lacking CI jobs)

@JoseSK999
Copy link
Copy Markdown
Contributor Author

Pushed f7e3521 to allow Floresta MSRV (1.81.0) to compile this crate

Comment thread src/lib.rs Outdated
impl Hintsfile {
const MAGIC: [u8; 4] = [0x55, 0x54, 0x58, 0x4f];
const VERSION: u8 = 0x00;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all of these added lines

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@rustaceanrob
Copy link
Copy Markdown
Member

LGTM minus the added lines

If we use `take_indices` we remove the `BTreeMap` key/value pairs, so at the end `stop_height` will return 0, rather than the actual stop height. Or we may process the highest block before the others, so the `stop_height` value would jump down to the next highest block.

This method should instead return a consistent stop height value. My Floresta implementation was unable to finish SwiftSync due to this unexpected behavior.
New `debug_assert` is now enforcing no duplicates in the elements for `EliasFano` compression.
@rustaceanrob
Copy link
Copy Markdown
Member

ACK 264cf95

@rustaceanrob rustaceanrob merged commit 7439c99 into 2140-dev:master Mar 10, 2026
@JoseSK999 JoseSK999 deleted the fix-stop-height branch March 10, 2026 14:00
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