Skip to content

test: cover TxUpdate::map_anchors#2116

Open
mubashirrao1122 wants to merge 3 commits intobitcoindevkit:masterfrom
mubashirrao1122:test/tx-update-map-anchors
Open

test: cover TxUpdate::map_anchors#2116
mubashirrao1122 wants to merge 3 commits intobitcoindevkit:masterfrom
mubashirrao1122:test/tx-update-map-anchors

Conversation

@mubashirrao1122
Copy link

This PR adds test coverage for TxUpdate::map_anchors.

It verifies that anchor values are correctly transformed while txids and other
fields (such as seen_ats) are preserved.

Tests:

  • cargo test -p bdk_core --test test_tx_update

Copilot AI review requested due to automatic review settings February 8, 2026 07:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds unit tests in bdk_core to exercise TxUpdate behaviors, primarily TxUpdate::map_anchors, ensuring anchors are transformed while other update fields remain intact.

Changes:

  • Add TxUpdate::is_empty coverage for populated txs and seen_ats.
  • Add coverage that TxUpdate::extend makes an update non-empty when extending with non-empty data.
  • Add a map_anchors test verifying anchor transformation and preservation of txid and seen_ats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 65 to 66
use bitcoin::hashes::Hash;

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

The inner use bitcoin::hashes::Hash; inside test_map_anchors_transforms_anchor_type_and_preserves_txid is redundant because the trait is already imported at module scope. This will trigger unused_imports and fail CI since clippy runs with -D warnings. Remove the inner use (or drop the module-level import and import the trait only where needed, but avoid duplicating it).

Suggested change
use bitcoin::hashes::Hash;

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Removed the redundant import to avoid unused_imports under clippy.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant