Struct bdk_chain::indexer::keychain_txout::ChangeSet
source · pub struct ChangeSet {
pub last_revealed: BTreeMap<DescriptorId, u32>,
}
Expand description
Represents updates to the derivation index of a KeychainTxOutIndex
.
It maps each keychain K
to a descriptor and its last revealed index.
It can be applied to KeychainTxOutIndex
with apply_changeset
.
The last_revealed
field is monotone in that merge
will never decrease it.
keychains_added
is not monotone, once it is set any attempt to change it is subject to the
same one-to-one keychain <-> descriptor mapping invariant as KeychainTxOutIndex
itself.
Fields§
§last_revealed: BTreeMap<DescriptorId, u32>
Contains for each descriptor_id the last revealed index of derivation
Implementations§
source§impl ChangeSet
impl ChangeSet
sourcepub const SCHEMA_NAME: &'static str = "bdk_keychaintxout"
pub const SCHEMA_NAME: &'static str = "bdk_keychaintxout"
Schema name for the changeset.
sourcepub const LAST_REVEALED_TABLE_NAME: &'static str = "bdk_descriptor_last_revealed"
pub const LAST_REVEALED_TABLE_NAME: &'static str = "bdk_descriptor_last_revealed"
Name for table that stores last revealed indices per descriptor id.
sourcepub fn init_sqlite_tables(db_tx: &Transaction<'_>) -> Result<()>
pub fn init_sqlite_tables(db_tx: &Transaction<'_>) -> Result<()>
Initialize sqlite tables for persisting
KeychainTxOutIndex
.
sourcepub fn from_sqlite(db_tx: &Transaction<'_>) -> Result<Self>
pub fn from_sqlite(db_tx: &Transaction<'_>) -> Result<Self>
Construct KeychainTxOutIndex
from sqlite database
and given parameters.
Remember to call Self::init_sqlite_tables
beforehand.
sourcepub fn persist_to_sqlite(&self, db_tx: &Transaction<'_>) -> Result<()>
pub fn persist_to_sqlite(&self, db_tx: &Transaction<'_>) -> Result<()>
Persist changeset
to the sqlite database.
Remember to call Self::init_sqlite_tables
beforehand.