Open
Conversation
287f17c to
c1f703e
Compare
c33e0dc to
169364b
Compare
Correctly calculate spendability of coins that are timelocked by taking MTP into account. API changes are a result of the different requirements between relative and absolute locktimes.
- Bump miniscript dependency from 12.3.5 to 13.0.0 - Remove `Signer` wrapper type (KeyMap now implements GetKey) - Adapt to bdk_chain CanonicalView API and CheckPoint<Header> generics - Update Emitter usage for new mempool API (update/evicted fields) - Use prev_mtp from CheckPoint for ConfirmationStatus - Point [patch.crates-io] to feature/bitcoind_rpc_emit_header branch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Convert repo to a Cargo workspace with a new unpublished bdk_tx_testenv crate under testenv/ - Merge the duplicated Wallet (examples/common.rs) and TestWallet (tests/timelock.rs) into a single Wallet struct with signer and secp fields always present - Deduplicate old_rpc_client() helper (was copied in 4 files) - Add all_candidates_with(&Assets) method for custom asset parameters - Reduce examples/common.rs to a thin re-export shim 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The `no-std` feature flag no longer exists for miniscript 13.0.0
Add 4 new time-based timelock tests that verify BDK's predictions match Bitcoin Core's actual broadcast acceptance at exact boundaries: - test_absolute_time_timelock_logic (integration) - test_relative_time_timelock_logic (integration) - test_is_time_timelocked_absolute_unit - test_is_time_timelocked_relative_unit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
169364b to
3d721da
Compare
Add comprehensive unit tests covering edge cases for is_block_timelocked, is_time_timelocked, and is_timelocked methods: - Unconfirmed inputs with relative timelocks (must be considered locked) - Missing prev_mtp for relative time locks (returns None) - No-lock and wrong-lock-type scenarios (return false/Some(false)) - Combined is_timelocked method with various lock combinations These tests cover the bug cases identified in PR bitcoindevkit#36 review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add `create_test_input` helper for unit tests and `Wallet::get_inputs` helper for integration tests, reducing ~720 lines of repeated code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
ValuedMammal
added a commit
that referenced
this pull request
Feb 13, 2026
a35ecbf refactor!: Rename `filter_unspendable_now` to `filter_unspendable` (志宇) 302faff fix!: Account for MTP in locktime calculations (志宇) Pull request description: ### Description Previously, time-based locktimes are based on header timestamps, but they should be based on MTP. ### Changes * Correctly calculate spendability of coins that are time-locked by taking MTP into account. * Rename `TxStatus` to `ConfirmationStatus`. * Split `is_timelocked` method into two methods as time-based and block-based timelocks have different required metadata. ### Testing Testing is done in #38 as they require some unreleased changes in upstream crates. ACKs for top commit: ValuedMammal: ACK a35ecbf aagbotemi: ACK a35ecbf Tree-SHA512: e037b292338d51bb1682c33106bc326ad5f1603f7c5d7542090e2625bf1cf08b3c3d43217724ed6e4d0ab39d646fb66e8fefee3b6a6bb6606f1c5c23d5d405be
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.
Description
This PR provides the testing infrastructure and integration tests for #36 (MTP locktime fixes). The tests require unreleased upstream changes, so they're separated from the core fix.
Changes
Dependency Updates
Signerwrapper type (KeyMap now implements GetKey directly)CanonicalViewAPI andCheckPoint<Header>genericsupdate/evictedfields)Test Infrastructure
bdk_tx_testenvcrate undertestenv/Walletstruct intobdk_tx_testenvso they can be used in both examples and testsall_candidates_with(&Assets)method for custom asset parametersIntegration Tests
Add 4 time-based timelock tests that verify BDK predictions match Bitcoin Core's actual broadcast acceptance at exact boundaries:
test_absolute_time_timelock_logictest_relative_time_timelock_logictest_is_time_timelocked_absolute_unittest_is_time_timelocked_relative_unitCI
no-stdfeature flag for miniscript (no longer exists in 13.0.0)Notes
[patch.crates-io]to point to unreleased upstream branches