Skip to content

Refactor TestEnv::wait_until_electrum_sees_block to be more concrete. #1640

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanlinjin
Copy link
Member

Description

Before, the signature of TestEnv::wait_until_electrum_sees_block only took in a delay: Duration input. It was not clear which block we were waiting for exactly. This PR adds 2 inputs to this method: a block_height target, and an optional block_hash method. Just having the block_height method waits until Electrs sees a block at that height, and all spk histories are up to date to that block. If the caller also includes a block_hash, we wait until Electrs sees a block at the given height, also has that block hash.

We also introduce a new method: TestEnv::wait_until_electrum_tip_syncs_with_bitcoind. The method name is self-explanatory.

Notes to the reviewers

It's a breaking change for bdk_testenv. The API now makes more sense.

Changelog notice

  • Change TestEnv::wait_until_electrum_sees_block to have a height target, and an optional block hash target.
  • Add TestEnv::wait_until_electrum_tip_syncs_with_bitcoind.

Checklists

All Submissions:

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

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

@evanlinjin evanlinjin force-pushed the fix/wait_until_electrum_sees_block branch 2 times, most recently from 4684a43 to ce565ac Compare October 4, 2024 21:26
@evanlinjin evanlinjin marked this pull request as ready for review October 4, 2024 21:26
@evanlinjin evanlinjin self-assigned this Oct 4, 2024
@evanlinjin evanlinjin added the api A breaking API change label Oct 4, 2024
@notmandatory notmandatory added tests and removed api A breaking API change labels Nov 15, 2024
@notmandatory notmandatory moved this to In Progress in BDK Chain Apr 23, 2025
Add inputs `block_height` and `block_hash` so that it is more concrete
what exactly we are waiting for.

Introduce `TestEnv::wait_until_electrum_tip_syncs_with_bitcoind`.
@evanlinjin evanlinjin force-pushed the fix/wait_until_electrum_sees_block branch from ce565ac to 0025f14 Compare May 16, 2025 13:27
@evanlinjin evanlinjin requested a review from LagginTimes May 16, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants