You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// This macro will be expanded to an object of type `Result<(Miniscript<DescriptorPublicKey, _>, KeyMap, ValidNetworks), DescriptorError>`. It allows writing
676
-
/// fragments of larger descriptors that can be pieced together using `fragment!(thresh_vec(m, ...))`.
677
+
/// This macro will be expanded to an object of type `Result<(Miniscript<DescriptorPublicKey, _>,
678
+
/// KeyMap, ValidNetworks), DescriptorError>`. It allows writing fragments of larger descriptors
679
+
/// that can be pieced together using `fragment!(thresh_vec(m, ...))`.
677
680
///
678
681
/// The syntax to write macro fragment is the same as documented for the [`descriptor`] macro.
679
682
#[macro_export]
@@ -846,11 +849,13 @@ mod test {
846
849
}
847
850
}
848
851
849
-
// - at least one of each "type" of operator; i.e. one modifier, one leaf_opcode, one leaf_opcode_value, etc.
852
+
// - at least one of each "type" of operator; i.e. one modifier, one leaf_opcode, one
853
+
// leaf_opcode_value, etc.
850
854
// - mixing up key types that implement IntoDescriptorKey in multi() or thresh()
851
855
852
856
// expected script for pk and bare manually created
853
-
// expected addresses created with `bitcoin-cli getdescriptorinfo` (for hash) and `bitcoin-cli deriveaddresses`
857
+
// expected addresses created with `bitcoin-cli getdescriptorinfo` (for hash) and `bitcoin-cli
858
+
// deriveaddresses`
854
859
855
860
#[test]
856
861
fntest_fixed_legacy_descriptors(){
@@ -1105,7 +1110,8 @@ mod test {
1105
1110
);
1106
1111
}
1107
1112
1108
-
// - verify the valid_networks returned is correctly computed based on the keys present in the descriptor
1113
+
// - verify the valid_networks returned is correctly computed based on the keys present in the
1114
+
// descriptor
1109
1115
#[test]
1110
1116
fntest_valid_networks(){
1111
1117
let xprv = bip32::Xpriv::from_str("tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy").unwrap();
// - verify the ScriptContext is correctly validated (i.e. passing a type that only impl IntoDescriptorKey<Segwitv0> to a pkh() descriptor should throw a compilation error
1171
+
// - verify the ScriptContext is correctly validated (i.e. passing a type that only impl
1172
+
// IntoDescriptorKey<Segwitv0> to a pkh() descriptor should throw a compilation error
// `indexes` at this point is a Vec<Vec<usize>>, with the "n choose k" of items (m of n)
367
+
// `indexes` at this point is a Vec<Vec<usize>>, with the "n choose k" of items (m
368
+
// of n)
367
369
indexes
368
370
.into_iter()
369
371
// .inspect(|x| println!("--- orig --- {:?}", x))
370
-
// we map each of the combinations of elements into a tuple of ([chosen items], [conditions]). unfortunately, those items have potentially more than one
371
-
// condition (think about ORs), so we also use `mix` to expand those, i.e. [[0], [1, 2]] becomes [[0, 1], [0, 2]]. This is necessary to make sure that we
372
+
// we map each of the combinations of elements into a tuple of ([chosen items],
373
+
// [conditions]). unfortunately, those items have potentially more than one
374
+
// condition (think about ORs), so we also use `mix` to expand those, i.e. [[0],
375
+
// [1, 2]] becomes [[0, 1], [0, 2]]. This is necessary to make sure that we
372
376
// consider every possible options and check whether or not they are compatible.
373
-
// since this step can turn one item of the iterator into multiple ones, we use `flat_map()` to expand them out
377
+
// since this step can turn one item of the iterator into multiple ones, we use
378
+
// `flat_map()` to expand them out
374
379
.flat_map(|i_vec| {
375
380
mix(i_vec
376
381
.iter()
@@ -386,7 +391,8 @@ impl Satisfaction {
386
391
.collect::<Vec<(Vec<usize>,Vec<Condition>)>>()
387
392
})
388
393
// .inspect(|x| println!("flat {:?}", x))
389
-
// try to fold all the conditions for this specific combination of indexes/options. if they are not compatible, try_fold will be Err
394
+
// try to fold all the conditions for this specific combination of
395
+
// indexes/options. if they are not compatible, try_fold will be Err
390
396
.map(|(key, val)| {
391
397
(
392
398
key,
@@ -503,15 +509,18 @@ impl Condition {
503
509
/// Errors that can happen while extracting and manipulating policies
504
510
#[derive(Debug,PartialEq,Eq)]
505
511
pubenumPolicyError{
506
-
/// Not enough items are selected to satisfy a [`SatisfiableItem::Thresh`] or a [`SatisfiableItem::Multisig`]
512
+
/// Not enough items are selected to satisfy a [`SatisfiableItem::Thresh`] or a
513
+
/// [`SatisfiableItem::Multisig`]
507
514
NotEnoughItemsSelected(String),
508
-
/// Index out of range for an item to satisfy a [`SatisfiableItem::Thresh`] or a [`SatisfiableItem::Multisig`]
515
+
/// Index out of range for an item to satisfy a [`SatisfiableItem::Thresh`] or a
516
+
/// [`SatisfiableItem::Multisig`]
509
517
IndexOutOfRange(usize),
510
518
/// Can not add to an item that is [`Satisfaction::None`] or [`Satisfaction::Complete`]
511
519
AddOnLeaf,
512
520
/// Can not add to an item that is [`Satisfaction::PartialComplete`]
513
521
AddOnPartialComplete,
514
-
/// Can not merge CSV or timelock values unless both are less than or both are equal or greater than 500_000_000
522
+
/// Can not merge CSV or timelock values unless both are less than or both are equal or greater
523
+
/// than 500_000_000
515
524
MixedTimelockUnits,
516
525
/// Incompatible conditions (not currently used)
517
526
IncompatibleConditions,
@@ -642,8 +651,8 @@ impl Policy {
642
651
/// create a transaction
643
652
///
644
653
/// What this means is that for some spending policies the user should select which paths in
645
-
/// the tree it intends to satisfy while signing, because the transaction must be created differently based
646
-
/// on that.
654
+
/// the tree it intends to satisfy while signing, because the transaction must be created
0 commit comments