pub enum ConfirmationStatus {
Confirmed(BlockHeight),
Mempool(BlockHeight),
Transmitted(BlockHeight),
Calculated(BlockHeight),
Failed(BlockHeight),
}Expand description
Transaction confirmation status. As a transaction is created and transmitted to the blockchain, it will move through each of these states. Received transactions will either be seen in the mempool or scanned from confirmed blocks. Variant order is logical display order for efficient sorting instead of the order of logical status flow.
Variants§
Confirmed(BlockHeight)
The transaction has been included in a confirmed block on the blockchain. The block height is the height of the confirmed block that contains the transaction.
Mempool(BlockHeight)
The transaction is known to be - or has been - in the mempool. The block height is the chain height when the transaction was seen in the mempool + 1 (target height).
Transmitted(BlockHeight)
The transaction has been transmitted to the blockchain but has not been seen in the mempool yet. The block height is the chain height when the transaction was transmitted + 1 (target height).
Calculated(BlockHeight)
The transaction has been created but not yet transmitted to the blockchain. The block height is the chain height when the transaction was created + 1 (target height).
Failed(BlockHeight)
The transaction has been created but failed to be transmitted, was not accepted into the mempool, was rejected from the mempool or expired before it was included in a confirmed block on the block chain. The block height is the chain height when the transaction was last updated + 1 (target height).
Implementations§
Source§impl ConfirmationStatus
impl ConfirmationStatus
Sourcepub fn is_confirmed(&self) -> bool
pub fn is_confirmed(&self) -> bool
A wrapper matching the Confirmed case.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed());
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed());
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed());
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed());Sourcepub fn is_confirmed_after_or_at(&self, comparison_height: &BlockHeight) -> bool
pub fn is_confirmed_after_or_at(&self, comparison_height: &BlockHeight) -> bool
To return true, the status must be confirmed and no earlier than specified height.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_after_or_at(&9.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_after_or_at(&10.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_after_or_at(&11.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_after_or_at(&9.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_after_or_at(&10.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_after_or_at(&11.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_after_or_at(&9.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_after_or_at(&10.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_after_or_at(&11.into()));
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed_after_or_at(&9.into()));
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed_after_or_at(&10.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_confirmed_after_or_at(&11.into()));Sourcepub fn is_confirmed_after(&self, comparison_height: &BlockHeight) -> bool
pub fn is_confirmed_after(&self, comparison_height: &BlockHeight) -> bool
To return true, the status must be confirmed and no earlier than specified height.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_after(&9.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_after(&10.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_after(&11.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_after(&9.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_after(&10.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_after(&11.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_after(&9.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_after(&10.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_after(&11.into()));
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed_after(&9.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_confirmed_after(&10.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_confirmed_after(&11.into()));Sourcepub fn is_confirmed_before_or_at(&self, comparison_height: &BlockHeight) -> bool
pub fn is_confirmed_before_or_at(&self, comparison_height: &BlockHeight) -> bool
To return true, the status must be confirmed and no later than specified height.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_before_or_at(&9.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_before_or_at(&10.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_before_or_at(&11.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_before_or_at(&9.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_before_or_at(&10.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_before_or_at(&11.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_before_or_at(&9.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_before_or_at(&10.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_before_or_at(&11.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_confirmed_before_or_at(&9.into()));
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed_before_or_at(&10.into()));
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed_before_or_at(&11.into()));Sourcepub fn is_confirmed_before(&self, comparison_height: &BlockHeight) -> bool
pub fn is_confirmed_before(&self, comparison_height: &BlockHeight) -> bool
To return true, the status must be confirmed earlier than specified height.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_before(&9.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_before(&10.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_confirmed_before(&11.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_before(&9.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_before(&10.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_confirmed_before(&11.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_before(&9.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_before(&10.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_confirmed_before(&11.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_confirmed_before(&9.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_confirmed_before(&10.into()));
assert!(ConfirmationStatus::Confirmed(10.into()).is_confirmed_before(&11.into()));Sourcepub fn is_pending_before(&self, comparison_height: &BlockHeight) -> bool
pub fn is_pending_before(&self, comparison_height: &BlockHeight) -> bool
To return true, the status must not be confirmed and it must have been submitted sufficiently far in the past. This allows deduction of expired transactions.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(10.into()).is_pending_before(&9.into()));
assert!(!ConfirmationStatus::Calculated(10.into()).is_pending_before(&10.into()));
assert!(ConfirmationStatus::Calculated(10.into()).is_pending_before(&11.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_pending_before(&9.into()));
assert!(!ConfirmationStatus::Transmitted(10.into()).is_pending_before(&10.into()));
assert!(ConfirmationStatus::Transmitted(10.into()).is_pending_before(&11.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_pending_before(&9.into()));
assert!(!ConfirmationStatus::Mempool(10.into()).is_pending_before(&10.into()));
assert!(ConfirmationStatus::Mempool(10.into()).is_pending_before(&11.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_pending_before(&9.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_pending_before(&10.into()));
assert!(!ConfirmationStatus::Confirmed(10.into()).is_pending_before(&11.into()));Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check if transaction has Calculated, Transmitted or Mempool status.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(ConfirmationStatus::Calculated(1.into()).is_pending());
assert!(ConfirmationStatus::Transmitted(1.into()).is_pending());
assert!(ConfirmationStatus::Mempool(1.into()).is_pending());
assert!(!ConfirmationStatus::Confirmed(1.into()).is_pending());
assert!(!ConfirmationStatus::Failed(1.into()).is_pending());Sourcepub fn is_failed(&self) -> bool
pub fn is_failed(&self) -> bool
Check if transaction has Failed status.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
assert!(!ConfirmationStatus::Calculated(1.into()).is_failed());
assert!(!ConfirmationStatus::Transmitted(1.into()).is_failed());
assert!(!ConfirmationStatus::Mempool(1.into()).is_failed());
assert!(!ConfirmationStatus::Confirmed(1.into()).is_failed());
assert!(ConfirmationStatus::Failed(1.into()).is_failed());Sourcepub fn get_confirmed_height(&self) -> Option<BlockHeight>
pub fn get_confirmed_height(&self) -> Option<BlockHeight>
Returns none if transaction is not confirmed, otherwise returns the height it was confirmed at.
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
let status = ConfirmationStatus::Confirmed(16.into());
assert_eq!(status.get_confirmed_height(), Some(16.into()));
let status = ConfirmationStatus::Mempool(15.into());
assert_eq!(status.get_confirmed_height(), None);Sourcepub fn get_height(&self) -> BlockHeight
pub fn get_height(&self) -> BlockHeight
§Examples
use zingo_status::confirmation_status::ConfirmationStatus;
use zcash_protocol::consensus::BlockHeight;
let status = ConfirmationStatus::Confirmed(15.into());
assert_eq!(status.get_height(), 15.into());Trait Implementations§
Source§impl Clone for ConfirmationStatus
impl Clone for ConfirmationStatus
Source§fn clone(&self) -> ConfirmationStatus
fn clone(&self) -> ConfirmationStatus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConfirmationStatus
Source§impl Debug for ConfirmationStatus
a more complete stringification
impl Debug for ConfirmationStatus
a more complete stringification
Source§impl Display for ConfirmationStatus
a public interface, writ in stone
impl Display for ConfirmationStatus
a public interface, writ in stone
impl Eq for ConfirmationStatus
Source§impl From<ConfirmationStatus> for String
impl From<ConfirmationStatus> for String
Source§fn from(value: ConfirmationStatus) -> Self
fn from(value: ConfirmationStatus) -> Self
Source§impl Ord for ConfirmationStatus
impl Ord for ConfirmationStatus
Source§fn cmp(&self, other: &ConfirmationStatus) -> Ordering
fn cmp(&self, other: &ConfirmationStatus) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ConfirmationStatus
impl PartialEq for ConfirmationStatus
Source§fn eq(&self, other: &ConfirmationStatus) -> bool
fn eq(&self, other: &ConfirmationStatus) -> bool
self and other values to be equal, and is used by ==.