diff --git a/sdk/program/src/message/account_keys.rs b/sdk/program/src/message/account_keys.rs index 8662f59ca..f0ab7deee 100644 --- a/sdk/program/src/message/account_keys.rs +++ b/sdk/program/src/message/account_keys.rs @@ -4,11 +4,12 @@ use { message::{v0::LoadedAddresses, CompileError}, pubkey::Pubkey, }, - std::{collections::BTreeMap, ops::Index}, + std::{collections::BTreeMap, iter::zip, ops::Index}, }; /// Collection of static and dynamically loaded keys used to load accounts /// during transaction processing. +#[derive(Clone, Default, Debug, Eq)] pub struct AccountKeys<'a> { static_keys: &'a [Pubkey], dynamic_keys: Option<&'a LoadedAddresses>, @@ -138,6 +139,12 @@ impl<'a> AccountKeys<'a> { } } +impl PartialEq for AccountKeys<'_> { + fn eq(&self, other: &Self) -> bool { + zip(self.iter(), other.iter()).all(|(a, b)| a == b) + } +} + #[cfg(test)] mod tests { use {super::*, crate::instruction::AccountMeta};