feat(wallet): wrap apply_block_events, apply_block_connected_to_events, apply_evicted_txs, checkpoints#44
Draft
darioAnongba wants to merge 3 commits intomainfrom
Draft
feat(wallet): wrap apply_block_events, apply_block_connected_to_events, apply_evicted_txs, checkpoints#44darioAnongba wants to merge 3 commits intomainfrom
darioAnongba wants to merge 3 commits intomainfrom
Conversation
added 3 commits
March 26, 2026 10:21
…s, apply_evicted_txs, checkpoints Add block-by-block processing APIs with event returns (closes #20): - Wallet::apply_block_events for applying a block via prev_blockhash - Wallet::apply_block_connected_to_events for explicit chain connection - Wallet::apply_evicted_txs for marking unconfirmed txs as evicted - Wallet::checkpoints for listing internal chain checkpoints New types: - Block (from_bytes deserialization, block_hash, prev_blockhash, time, txdata, tx_count) - BlockId constructor from height and hash string - EvictedTx for pairing txid with eviction timestamp New error codes: - BdkErrorCode::CannotConnect - BdkErrorCode::UnexpectedConnectedToHash Includes unit tests for BlockId, Block, EvictedTx, apply_evicted_txs, and checkpoints.
- Use CannotConnectError for apply_block_events (not ApplyBlockError) - Use ApplyHeaderError for apply_block_connected_to_events - Fix cargo fmt line wrapping in imports and map_err chains
darioAnongba
commented
Mar 26, 2026
Collaborator
Author
darioAnongba
left a comment
There was a problem hiding this comment.
no real tests. The only tests in wallet.test.ts are doing nothing. We need real tests using the regtest environment.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Wraps BDK 2.3.0 block-by-block processing APIs with event returns.
Closes #20
Changes
New Wallet methods
apply_block_events(block, height)— Apply a block connecting viaprev_blockhash, returnsWalletEvent[]apply_block_connected_to_events(block, height, connected_to)— Apply a block with explicit chain connection point, returnsWalletEvent[]apply_evicted_txs(evicted_txs)— Mark unconfirmed transactions as evicted from the mempoolcheckpoints()— List all checkpoints in the wallet's internal chainNew types
Block— Full Bitcoin block withfrom_bytes()deserialization and accessors (block_hash,prev_blockhash,time,txdata,tx_count)BlockIdconstructor — Create from height and hash string (was previously only constructable internally)EvictedTx— Pair a transaction ID with an eviction timestamp forapply_evicted_txsNew error codes
BdkErrorCode.CannotConnect— Block cannot connect to existing chainBdkErrorCode.UnexpectedConnectedToHash— Connected-to hash mismatchTests
BlockId,Block,EvictedTx,apply_evicted_txs, andcheckpointsCHANGELOG
[Unreleased]section with all new items