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<A> ChangeSet<A>
impl<A> ChangeSet<A>
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 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.