Skip to content

Conversation

luisschwab
Copy link
Member

Description

Closes #94.

This PR replaces bitcoin::Network for bitcoin::NetworkKind where it applies.

I also took the liberty of fixing up and adding comments on the files I touched.

Changelog

  • wallet_name_from_descriptor() takes NetworkKind instead of Network.
  • FnOnce takes NetworkKind instead of Network.
  • impl IntoWalletDescriptor for <T> takes Network instead NetworkKind.
  • DescriptorTemplate::build() takes NetworkKind instead of Network.
  • ExtendedKey::into_xprv() takes NetworkKind instead of Network.
  • ExtendedKey::into_xpub() takes NetworkKind instead of Network.
  • DerivableKey::into_extended_key() examples updated to use NetworkKind instead of Network.
  • any_network() renamed to any_network_kind().
  • mainnet_network() renamed to mainnet_network_kind().
  • test_networks() renamed to test_network_kind().
  • merge_networks() renamed to merge_network_kinds().
  • ValidNetworks type alias renamed to ValidNetworkKinds.
  • GeneratedKey::new() takes ValidNetworkKinds instead of ValidNetworks.
  • DescriptorKey::from_public() takes ValidNetworkKinds instead of ValidNetworks.
  • DescriptorKey::from_secret() takes ValidNetworkKinds instead of ValidNetworks.
  • KeyError::InvalidNetwork renamed to KeyError::InvalidNetworkKind.
  • DescriptorKey::override_valid_networks() renamed to override_valid_network_kinds().
  • Network validation logic updated to use NetworkKind instead of Network.
  • Test network validation now uses NetworkKind::Test instead of Network::{Regtest, Signet, Testnet, Testnet4}.
  • Examples and comments updated to use NetworkKind instead of Network.

Checklists

All Submissions:

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

New Features:

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

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@coveralls
Copy link

coveralls commented Jun 1, 2025

Pull Request Test Coverage Report for Build 15983971214

Details

  • 331 of 362 (91.44%) changed or added relevant lines in 9 files are covered.
  • 14 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-1.0%) to 84.554%

Changes Missing Coverage Covered Lines Changed/Added Lines %
wallet/src/keys/bip39.rs 13 14 92.86%
wallet/src/descriptor/dsl.rs 38 40 95.0%
wallet/src/wallet/mod.rs 10 13 76.92%
wallet/src/descriptor/template.rs 116 120 96.67%
wallet/src/descriptor/policy.rs 15 21 71.43%
wallet/src/descriptor/mod.rs 48 55 87.27%
wallet/src/keys/mod.rs 89 97 91.75%
Files with Coverage Reduction New Missed Lines %
wallet/src/descriptor/dsl.rs 1 95.36%
wallet/src/wallet/changeset.rs 2 85.0%
wallet/src/descriptor/policy.rs 3 79.07%
wallet/src/descriptor/template.rs 4 97.46%
wallet/src/wallet/mod.rs 4 81.08%
Totals Coverage Status
Change from base Build 15719064446: -1.0%
Covered Lines: 6509
Relevant Lines: 7698

💛 - Coveralls

@luisschwab luisschwab force-pushed the feat/networkkind branch 2 times, most recently from 22d27a6 to e6e6266 Compare June 1, 2025 17:41
@luisschwab luisschwab self-assigned this Jun 1, 2025
@luisschwab luisschwab added the api A breaking API change label Jun 1, 2025
@luisschwab luisschwab moved this to Needs Review in BDK Wallet Jun 1, 2025
@luisschwab luisschwab modified the milestones: Wallet 3.1.0, Wallet 3.0.0 Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

feat: use new NetworkKind throughout the BDK codebase
2 participants