Skip to content

Conversation

@tnull
Copy link
Contributor

@tnull tnull commented Oct 29, 2025

Description

Previously, we added a new Wallet::apply_update_events method that returned WalletEvents. Unfortunately, no corresponding APIs were added for the apply_block counterparts. Here we fix this omission.

Notes to the reviewers

I opened this towards the release-2.2 branch, but it would probably need another release branch. Or let me know if you prefer to open it against master (which seems to be lacking apply_update_events currently though).

I also added no test coverage given that none seems to exist for Wallet::apply_block in the first place. Let me know if I should add something here.

Checklists

All Submissions:

New Features:

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

cc @notmandatory

@coveralls
Copy link

coveralls commented Oct 29, 2025

Pull Request Test Coverage Report for Build 18936234986

Details

  • 0 of 55 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.6%) to 84.484%

Changes Missing Coverage Covered Lines Changed/Added Lines %
wallet/src/wallet/mod.rs 0 55 0.0%
Totals Coverage Status
Change from base Build 18924169382: -0.6%
Covered Lines: 6997
Relevant Lines: 8282

💛 - Coveralls

@ValuedMammal ValuedMammal moved this to In Progress in BDK Wallet Oct 29, 2025
@ValuedMammal ValuedMammal added this to the Wallet 3.0.0 milestone Oct 29, 2025
@ValuedMammal ValuedMammal added the new feature New feature or request label Oct 29, 2025
block: &Block,
height: u32,
) -> Result<Vec<WalletEvent>, CannotConnectError> {
let connected_to = match height.checked_sub(1) {

Choose a reason for hiding this comment

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

Thanks for working on this. I noticed apply_block_events seems to duplicate logic from apply_block. Could we move the event handling from apply_block_connected_to_events into apply_block_events, then have it call apply_block instead of apply_block_connected_to? Would be more consistent with how apply_update_event works and avoid the duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I intentionally added variants for apply_block as well as for apply_block_connected_to as we may also want to use apply_block_connected_to_events at some point.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could have apply_block call the new apply_block_events and map the return value to ().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You could have apply_block call the new apply_block_events and map the return value to ().

Hmm, but that would run the (possibly costly) delta calculation for everybody, even if they wouldn't make use of the events. I believe this is why @notmandatory added separate _event variants of the methods in the first place.

@notmandatory
Copy link
Member

PR needs a rebase on the release/2.2 branch to fix the CI issue, see #338.

Previously, we added a new `Wallet::apply_update_events` method that
returned `WalletEvent`s. Unfortunately, no corresponding APIs were added
for the `apply_block` counterparts. Here we fix this omission.
@tnull tnull force-pushed the 2025-10-add-apply-block-events branch from 3039c1b to df444d0 Compare October 30, 2025 09:37
@tnull
Copy link
Contributor Author

tnull commented Oct 30, 2025

PR needs a rebase on the release/2.2 branch to fix the CI issue, see #338.

Rebased on release/2.2, but still wondering if we'd need a release/2.3 branch for this, given it extends API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants