From: Vladimir Fomene Date: Wed, 9 Aug 2023 07:42:47 +0000 (+0300) Subject: feat: Implement Anchor for BlockId X-Git-Tag: v1.0.0-alpha.2~19^2~1 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.ScriptPath.html?a=commitdiff_plain;h=480c2730de524cbb19a72d8cc8c41cb73ab556df;p=bdk feat: Implement Anchor for BlockId --- diff --git a/crates/chain/src/chain_data.rs b/crates/chain/src/chain_data.rs index 16877637..c5de09bb 100644 --- a/crates/chain/src/chain_data.rs +++ b/crates/chain/src/chain_data.rs @@ -87,6 +87,9 @@ impl From> 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 {