Struct TxUpdate

Source
#[non_exhaustive]
pub struct TxUpdate<A = ()> { pub txs: Vec<Arc<Transaction>>, pub txouts: BTreeMap<OutPoint, TxOut>, pub anchors: BTreeSet<(A, Txid)>, pub seen_ats: HashSet<(Txid, u64)>, pub evicted_ats: HashSet<(Txid, u64)>, }
Expand description

Data object used to communicate updates about relevant transactions from some chain data source to the core model (usually a bdk_chain::TxGraph).

use bdk_core::TxUpdate;
let mut tx_update = TxUpdate::default();
tx_update.txs.push(tx);
tx_update.anchors.insert((anchor, txid));

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§txs: Vec<Arc<Transaction>>

Full transactions. These are transactions that were determined to be relevant to the wallet given the request.

§txouts: BTreeMap<OutPoint, TxOut>

Floating txouts. These are TxOuts that exist but the whole transaction wasn’t included in txs since only knowing about the output is important. These are often used to help determine the fee of a wallet transaction.

§anchors: BTreeSet<(A, Txid)>

Transaction anchors. Anchors tells us a position in the chain where a transaction was confirmed.

§seen_ats: HashSet<(Txid, u64)>

When transactions were seen in the mempool.

An unconfirmed transaction can only be canonical with a seen_at value. It is the responsibility of the chain-source to include the seen_at values for unconfirmed (unanchored) transactions.

FullScanRequest::start_time or SyncRequest::start_time can be used to provide the seen_at value.

§evicted_ats: HashSet<(Txid, u64)>

When transactions were discovered to be missing (evicted) from the mempool.

SyncRequest::start_time can be used to provide the evicted_at value.

Implementations§

Source§

impl<A> TxUpdate<A>

Source

pub fn is_empty(&self) -> bool

Returns true if the TxUpdate contains no elements in any of its fields.

Source§

impl<A> TxUpdate<A>
where A: Ord,

Source

pub fn map_anchors<A2, F>(self, map: F) -> TxUpdate<A2>
where A2: Ord, F: FnMut(A) -> A2,

Transforms the TxUpdate to have anchors (A) of another type (A2).

This takes in a closure with signature FnMut(A) -> A2 which is called for each anchor to transform it.

Source

pub fn extend(&mut self, other: TxUpdate<A>)

Extend this update with other.

Trait Implementations§

Source§

impl<A> Clone for TxUpdate<A>
where A: Clone,

Source§

fn clone(&self) -> TxUpdate<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A> Debug for TxUpdate<A>
where A: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<A> Default for TxUpdate<A>

Source§

fn default() -> TxUpdate<A>

Returns the “default value” for a type. Read more
Source§

impl<A: Ord> From<TxGraph<A>> for TxUpdate<A>

Source§

fn from(graph: TxGraph<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Anchor> From<TxUpdate<A>> for TxGraph<A>

Source§

fn from(update: TxUpdate<A>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<A> Freeze for TxUpdate<A>

§

impl<A> RefUnwindSafe for TxUpdate<A>
where A: RefUnwindSafe,

§

impl<A> Send for TxUpdate<A>
where A: Send,

§

impl<A> Sync for TxUpdate<A>
where A: Sync,

§

impl<A> Unpin for TxUpdate<A>

§

impl<A> UnwindSafe for TxUpdate<A>
where A: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V