]> Untitled Git - bdk/commitdiff
test(chain): add block_id! utility macro
authorDaniela Brozzoni <danielabrozzoni@protonmail.com>
Fri, 29 Sep 2023 14:02:48 +0000 (16:02 +0200)
committerDaniela Brozzoni <danielabrozzoni@protonmail.com>
Wed, 4 Oct 2023 12:00:45 +0000 (14:00 +0200)
Co-authored-by: Wei Chen <wzc110@gmail.com>
crates/chain/tests/common/mod.rs

index 2573fd9618afd9639d6967c057d8787f956587ff..694d90dc98fb54621ef2a7b349ea33e0fce10239 100644 (file)
@@ -1,3 +1,13 @@
+#[allow(unused_macros)]
+macro_rules! block_id {
+    ($height:expr, $hash:literal) => {{
+        bdk_chain::BlockId {
+            height: $height,
+            hash: bitcoin::hashes::Hash::hash($hash.as_bytes()),
+        }
+    }};
+}
+
 #[allow(unused_macros)]
 macro_rules! h {
     ($index:literal) => {{