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 schema_v0() -> String
pub fn schema_v0() -> String
Get v0 of sqlite keychain_txout::ChangeSet schema
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.