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
{{ message }}
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
Something like this because with the current method using range_descriptor_spks the returned iterator will not be able quickly call skip or nth on the iterator. It will do all the intermediate derivations.
use bitcoin::{
secp256k1::{Secp256k1,VerifyOnly},Script,};use miniscript::{Descriptor,DescriptorPublicKey};/// An iterator over a descriptor's script pubkeys.///// TODO: put this into miniscript#[derive(Clone,Debug)]pubstructSpkIter{descriptor:Descriptor<DescriptorPublicKey>,index:usize,secp:Secp256k1<VerifyOnly>,end:usize,}implSpkIter{/// Creates a new script pubkey iterator starting at 0 from a descriptorpubfnnew(descriptor:Descriptor<DescriptorPublicKey>) -> Self{let secp = Secp256k1::verification_only();let end = if descriptor.has_wildcard(){// Because we only iterate over non-hardened indexes there are 2^31 values(1 << 31) - 1}else{0};Self{
descriptor,index:0,
secp,
end,}}}implIteratorforSpkIter{typeItem = (u32,Script);fnnth(&mutself,n:usize) -> Option<Self::Item>{self.index = self.index.saturating_add(n);self.next()}fnnext(&mutself) -> Option<Self::Item>{let index = self.index;if index > self.end{returnNone;}let script = self.descriptor.at_derivation_index(self.indexasu32).derived_descriptor(&self.secp).expect("the descritpor cannot need hardened derivation").script_pubkey();self.index += 1;Some((index asu32, script))}}
The text was updated successfully, but these errors were encountered:
Something like this because with the current method using
range_descriptor_spks
the returned iterator will not be able quickly callskip
ornth
on the iterator. It will do all the intermediate derivations.The text was updated successfully, but these errors were encountered: