From db3676bad1994deff1cecb8ccf641abd664cd528 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 24 Jan 2025 09:21:28 +0100 Subject: [PATCH] feat: add clone_transactions convenience fn --- crates/primitives-traits/src/block/body.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/primitives-traits/src/block/body.rs b/crates/primitives-traits/src/block/body.rs index bbbd70654149..43bb0a3fafe0 100644 --- a/crates/primitives-traits/src/block/body.rs +++ b/crates/primitives-traits/src/block/body.rs @@ -47,6 +47,13 @@ pub trait BlockBody: self.transactions().iter() } + /// Clones the transactions in the block. + /// + /// This is a convenience function for `transactions().to_vec()` + fn clone_transactions(&self) -> Vec { + self.transactions().to_vec() + } + /// Returns an iterator over all transaction hashes in the block body. fn transaction_hashes_iter(&self) -> impl Iterator + '_ { self.transactions_iter().map(|tx| tx.tx_hash())