Skip to content

Commit 4376766

Browse files
committed
feat!(wallet): use NetworkKind
1 parent 3c17c42 commit 4376766

File tree

5 files changed

+117
-110
lines changed

5 files changed

+117
-110
lines changed

wallet/src/descriptor/dsl.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -826,17 +826,13 @@ macro_rules! fragment {
826826
#[cfg(test)]
827827
mod test {
828828
use alloc::string::ToString;
829-
use bitcoin::secp256k1::Secp256k1;
830-
use miniscript::descriptor::{DescriptorPublicKey, KeyMap};
831-
use miniscript::{Descriptor, Legacy, Segwitv0};
832-
833829
use core::str::FromStr;
834830

831+
use miniscript::{descriptor::{DescriptorPublicKey, KeyMap}, Descriptor, Legacy, Segwitv0};
832+
use bitcoin::{secp256k1::Secp256k1, bip32, PrivateKey, Network, NetworkKind};
833+
835834
use crate::descriptor::{DescriptorError, DescriptorMeta};
836835
use crate::keys::{DescriptorKey, IntoDescriptorKey, ValidNetworkKinds};
837-
use bitcoin::bip32;
838-
use bitcoin::NetworkKind;
839-
use bitcoin::PrivateKey;
840836

841837
// Test the `descriptor!()` macro.
842838

@@ -854,7 +850,7 @@ mod test {
854850
let child_desc = desc
855851
.at_derivation_index(i as u32)
856852
.expect("i is not hardened");
857-
let address = child_desc.address(bitcoin::Network::Regtest.into());
853+
let address = child_desc.address(Network::Regtest);
858854
if let Ok(address) = address {
859855
assert_eq!(address.to_string(), *expected.get(i).unwrap());
860856
} else {

wallet/src/wallet/changeset.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ type IndexedTxGraphChangeSet =
3434
///
3535
/// ## Members and required fields
3636
///
37-
/// The change set has certain required fields without which a `Wallet` cannot function.
38-
/// These include the [`descriptor`] and the [`network`] in use. These are required to be non-empty
39-
/// *in the aggregate*, meaning the field must be present and non-null in the union of all
37+
/// The change set has certain required fields without which a [`Wallet`] cannot function.
38+
/// These include the [`descriptor`] and the [`bitcoin::Network`] in use. These are required to be
39+
/// non-empty *in the aggregate*, meaning the field must be present and non-null in the union of all
4040
/// persisted changes, but may be empty in any one change set, where "empty" is defined by the
4141
/// [`Merge`](Merge::is_empty) implementation of that change set. This requirement also applies to
4242
/// the [`local_chain`] field in that the aggregate change set must include a genesis block.
4343
///
44-
/// For example, the descriptor and network are present in the first change set after wallet
45-
/// creation, but are usually omitted in subsequent updates, as they are not permitted to change
46-
/// at any point thereafter.
44+
/// For example, the [`descriptor`] and [`bitcoin::Network`] are present in the first change set
45+
/// after wallet creation, but are usually omitted in subsequent updates, as they are not permitted
46+
/// to change at any point thereafter.
4747
///
4848
/// Other fields of the change set are not required to be non-empty, that is they may be empty even
4949
/// in the aggregate. However in practice they should contain the data needed to recover a wallet

0 commit comments

Comments
 (0)