Skip to main content

AddressStore

Trait AddressStore 

Source
pub trait AddressStore {
    type Error;
    type AccountRef: Copy + Eq + Hash;

    // Required methods
    fn find_gap_start(
        &self,
        account_ref: Self::AccountRef,
        key_scope: TransparentKeyScope,
        gap_limit: u32,
    ) -> Result<Option<NonHardenedChildIndex>, Self::Error>;
    fn store_address_range(
        &mut self,
        account_id: Self::AccountRef,
        key_scope: TransparentKeyScope,
        list: Vec<(Address, TransparentAddress, NonHardenedChildIndex)>,
    ) -> Result<(), Self::Error>;
}
Available on crate feature transparent-inputs and (crate features transparent-inputs or transparent-key-encoding) only.
Expand description

A trait providing wallet storage operations required for transparent address gap limit management.

Implementations of this trait allow the gap limit logic in generate_gap_addresses to query and update the wallet’s transparent address state without being coupled to a specific storage backend.

Required Associated Types§

Source

type Error

The type of errors produced by the wallet storage backend.

Source

type AccountRef: Copy + Eq + Hash

A wallet-internal account identifier.

Required Methods§

Source

fn find_gap_start( &self, account_ref: Self::AccountRef, key_scope: TransparentKeyScope, gap_limit: u32, ) -> Result<Option<NonHardenedChildIndex>, Self::Error>

Returns the transparent address index at the start of the first gap of at least gap_limit indices in the given account, considering only addresses derived for the specified key scope.

Returns Ok(None) if the gap would start at an index greater than the maximum valid non-hardened transparent child index.

Source

fn store_address_range( &mut self, account_id: Self::AccountRef, key_scope: TransparentKeyScope, list: Vec<(Address, TransparentAddress, NonHardenedChildIndex)>, ) -> Result<(), Self::Error>

Persists a range of derived transparent addresses to the wallet storage.

Each entry in the list contains the wallet-level address, the raw transparent address, and the child index from which the address was derived.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§