pub struct ChangeSet<A = ()> {
pub txs: BTreeSet<Arc<Transaction>>,
pub txouts: BTreeMap<OutPoint, TxOut>,
pub anchors: BTreeSet<(A, Txid)>,
pub last_seen: BTreeMap<Txid, u64>,
}
Expand description
The ChangeSet
represents changes to a TxGraph
.
Since TxGraph
is monotone, the “changeset” can only contain transactions to be added and
not removed.
Refer to module-level documentation for more.
Fields§
§txs: BTreeSet<Arc<Transaction>>
Added transactions.
txouts: BTreeMap<OutPoint, TxOut>
Added txouts.
anchors: BTreeSet<(A, Txid)>
Added anchors.
last_seen: BTreeMap<Txid, u64>
Added last-seen unix timestamps of transactions.
Implementations§
Source§impl<A> ChangeSet<A>
impl<A> ChangeSet<A>
Sourcepub fn txouts(&self) -> impl Iterator<Item = (OutPoint, &TxOut)>
pub fn txouts(&self) -> impl Iterator<Item = (OutPoint, &TxOut)>
Iterates over all outpoints contained within ChangeSet
.
Sourcepub fn anchor_heights(&self) -> impl Iterator<Item = u32> + '_where
A: Anchor,
pub fn anchor_heights(&self) -> impl Iterator<Item = u32> + '_where
A: Anchor,
Iterates over the heights of that the new transaction anchors in this changeset.
This is useful if you want to find which heights you need to fetch data about in order to confirm or exclude these anchors.
Source§impl ChangeSet<ConfirmationBlockTime>
impl ChangeSet<ConfirmationBlockTime>
Sourcepub const SCHEMA_NAME: &'static str = "bdk_txgraph"
pub const SCHEMA_NAME: &'static str = "bdk_txgraph"
Schema name for tx_graph::ChangeSet
.
Sourcepub const TXS_TABLE_NAME: &'static str = "bdk_txs"
pub const TXS_TABLE_NAME: &'static str = "bdk_txs"
Name of table that stores full transactions and last_seen
timestamps.
Sourcepub const TXOUTS_TABLE_NAME: &'static str = "bdk_txouts"
pub const TXOUTS_TABLE_NAME: &'static str = "bdk_txouts"
Name of table that stores floating txouts.
Sourcepub const ANCHORS_TABLE_NAME: &'static str = "bdk_anchors"
pub const ANCHORS_TABLE_NAME: &'static str = "bdk_anchors"
Name of table that stores Anchor
s.
Sourcepub fn schema_v0() -> String
pub fn schema_v0() -> String
Get v0 of sqlite tx_graph::ChangeSet schema
Sourcepub fn schema_v1() -> String
pub fn schema_v1() -> String
Get v1 of sqlite tx_graph::ChangeSet schema
Sourcepub fn init_sqlite_tables(db_tx: &Transaction<'_>) -> Result<()>
pub fn init_sqlite_tables(db_tx: &Transaction<'_>) -> Result<()>
Initialize sqlite tables.
Sourcepub fn from_sqlite(db_tx: &Transaction<'_>) -> Result<Self>
pub fn from_sqlite(db_tx: &Transaction<'_>) -> Result<Self>
Construct a TxGraph
from an sqlite database.
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.