Skip to content
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

fix(electrum): fixed chain sync issue #1163

Closed

Conversation

evanlinjin
Copy link
Member

@evanlinjin evanlinjin commented Oct 10, 2023

Description

This replaces #1145 and is based on this comment: #1145 (comment). I pushed forward with this as I think it is a really good idea to include this in our alpha.2 milestone.

This may or may not fix #1125 (however, neither @LagginTimes or myself can replicate the issue @danielabrozzoni has been running into - check #1145 for convo). We can confirm whether it does once we have proper tests. However, these changes here obviously fix a logical flaw.

  • Fixed a logic error in construct_update_tip that caused the local chain tip to always be a block behind the actual tip.
  • Docs are added to clarify the construct_update_tip logic.
  • ASSUME_FINAL_DEPTH is renamed to MAX_REORG_DEPTH.

Notes to the reviewers

This is tested manually (we need to add a proper test framework in the near future). I can perform the following successfully:

  • example_electrum scan can detect incoming transactions when unconfirmed, and detect that is becomes confirm in later calls.
  • exampl_electrum sync can do that same.

Changelog notice

  • Fixed a logic error in construct_update_tip that caused the local chain tip to always be a block behind the actual tip.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

Bugfixes:

* [ ] This pull request breaks the existing API
* [ ] I've added tests to reproduce the issue which are now passing

  • I'm linking the issue being fixed by this PR

@evanlinjin evanlinjin added the bug Something isn't working label Oct 10, 2023
@evanlinjin evanlinjin added this to the 1.0.0-alpha.2 milestone Oct 10, 2023
@evanlinjin evanlinjin self-assigned this Oct 10, 2023
@evanlinjin evanlinjin force-pushed the example_electrum_sync branch from 5a902d5 to b2ccba3 Compare October 10, 2023 09:34
* Fixed a logic error in `construct_update_tip` that caused the local
  chain tip to always be a block behind the actual tip.
* Docs are added to clarify the `construct_update_tip` logic.
* `ASSUME_FINAL_DEPTH` is renamed to `MAX_REORG_DEPTH`.

Testing:

This is tested manually (we need to add a proper test framework in the
near future).

`example_electrum scan` can detect incoming transactions when
unconfirmed, and detect that is becomes confirm in later calls.

`exampl_electrum sync` can do that same.

Co-authored-by: Wei Chen <[email protected]>
Copy link
Member

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

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

ACK 55ad9e8 - I'm still encountering the bug every now and then, but I still want to merge this PR as it fixes an obvious issue.

@LLFourn
Copy link
Contributor

LLFourn commented Oct 11, 2023

See comment here: #1145 (comment)

I still think that the renaming here is embedding a mistaken concept. There is no MAX_REORG_DEPTH for this algorithm (it can withstand a reorg of any depth).

Also can we please have a test that reproduces the issue and fixes it in this PR. This does not block alpha.2 IMO. You can release a new version of the electrum crate (patch release) after alpha.2.

@evanlinjin
Copy link
Member Author

I agree with @LLFourn's points. This can be continued on #1145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
3 participants