Skip to content

Commit 6731dcb

Browse files
committed
DescriptorTypes moved to LNP/BP Core Lib
1 parent 57d7267 commit 6731dcb

File tree

4 files changed

+12
-34
lines changed

4 files changed

+12
-34
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/descriptors.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl From<miniscript::Error> for Error {
5151
pub struct DescriptorGenerator {
5252
pub name: String,
5353
pub content: DescriptorContent,
54-
pub types: DescriptorTypes,
54+
pub types: descriptor::Variants,
5555
}
5656

5757
impl DescriptorGenerator {
@@ -166,30 +166,6 @@ impl DescriptorGenerator {
166166
}
167167
}
168168

169-
#[derive(
170-
Clone, PartialEq, Eq, PartialOrd, Ord, Debug, StrictEncode, StrictDecode,
171-
)]
172-
pub struct DescriptorTypes {
173-
pub bare: bool,
174-
pub hashed: bool,
175-
pub nested: bool,
176-
pub segwit: bool,
177-
pub taproot: bool,
178-
}
179-
180-
impl DescriptorTypes {
181-
pub fn has_match(&self, descriptor_type: descriptor::Category) -> bool {
182-
match descriptor_type {
183-
descriptor::Category::Bare => self.bare,
184-
descriptor::Category::Hashed => self.hashed,
185-
descriptor::Category::Nested => self.nested,
186-
descriptor::Category::SegWit => self.segwit,
187-
descriptor::Category::Taproot => self.taproot,
188-
_ => false,
189-
}
190-
}
191-
}
192-
193169
#[derive(
194170
Clone,
195171
PartialEq,

src/model/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ mod tracking;
1818
mod utxo;
1919

2020
pub use descriptors::{
21-
DescriptorContent, DescriptorGenerator, DescriptorTypes,
22-
Error as DescriptorError, SourceType,
21+
DescriptorContent, DescriptorGenerator, Error as DescriptorError,
22+
SourceType,
2323
};
2424
pub use document::{Document, Error, Profile, ResolverError};
2525
pub use tracking::{

src/view_controller/descriptor_dlg.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ use std::collections::HashSet;
1717
use std::rc::Rc;
1818
use std::str::FromStr;
1919

20+
use lnpbp::bp::descriptor;
21+
2022
use crate::controller::utxo_lookup::{self, UtxoLookup};
2123
use crate::model::{
22-
DescriptorContent, DescriptorGenerator, DescriptorTypes, Document,
23-
ResolverError, SourceType, TrackingAccount, TrackingKey, UtxoEntry,
24+
DescriptorContent, DescriptorGenerator, Document, ResolverError,
25+
SourceType, TrackingAccount, TrackingKey, UtxoEntry,
2426
};
2527
use crate::util::resolver_mode::{self, ResolverModeType};
2628
use crate::view_controller::PubkeySelectDlg;
@@ -501,8 +503,8 @@ impl DescriptorDlg {
501503
Ok(content)
502504
}
503505

504-
pub fn descriptor_types(&self) -> DescriptorTypes {
505-
DescriptorTypes {
506+
pub fn descriptor_types(&self) -> descriptor::Variants {
507+
descriptor::Variants {
506508
bare: self.bare_check.get_active(),
507509
hashed: self.hash_check.get_active(),
508510
nested: self.compat_check.get_active(),

0 commit comments

Comments
 (0)