feat: Implement Anchor for BlockId
This commit is contained in:
parent
0cd2348166
commit
480c2730de
@ -87,6 +87,9 @@ impl From<ChainPosition<ConfirmationTimeAnchor>> for ConfirmationTime {
|
||||
}
|
||||
|
||||
/// A reference to a block in the canonical chain.
|
||||
///
|
||||
/// `BlockId` implements [`Anchor`]. When a transaction is anchored to `BlockId`, the confirmation
|
||||
/// block and anchor block are the same block.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Copy, PartialOrd, Ord, core::hash::Hash)]
|
||||
#[cfg_attr(
|
||||
feature = "serde",
|
||||
@ -100,6 +103,12 @@ pub struct BlockId {
|
||||
pub hash: BlockHash,
|
||||
}
|
||||
|
||||
impl Anchor for BlockId {
|
||||
fn anchor_block(&self) -> Self {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BlockId {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user