diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 765c997..9be878d 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -58,6 +58,7 @@ interface AddressIndex { New(); LastUnused(); Peek(u32 index); + Reset(u32 index); }; enum Network { diff --git a/bdk-ffi/src/lib.rs b/bdk-ffi/src/lib.rs index 6389fbc..81dadb3 100644 --- a/bdk-ffi/src/lib.rs +++ b/bdk-ffi/src/lib.rs @@ -74,6 +74,14 @@ pub enum AddressIndex { /// Use with caution, if an index is given that is less than the current descriptor index /// then the returned address may have already been used. Peek { index: u32 }, + /// Return the address for a specific descriptor index and reset the current descriptor index + /// used by `AddressIndex::New` and `AddressIndex::LastUsed` to this value. + /// Use with caution, if an index is given that is less than the current descriptor index + /// then the returned address and subsequent addresses returned by calls to `AddressIndex::New` + /// and `AddressIndex::LastUsed` may have already been used. Also if the index is reset to a + /// value earlier than the [`crate::blockchain::Blockchain`] stop_gap (default is 20) then a + /// larger stop_gap should be used to monitor for all possibly used addresses. + Reset { index: u32 }, } impl From for BdkAddressIndex { @@ -82,6 +90,7 @@ impl From for BdkAddressIndex { AddressIndex::New => BdkAddressIndex::New, AddressIndex::LastUnused => BdkAddressIndex::LastUnused, AddressIndex::Peek { index } => BdkAddressIndex::Peek(index), + AddressIndex::Reset { index } => BdkAddressIndex::Reset(index), } } }