From b36f75354f10e42385f2290124605e42826dfa53 Mon Sep 17 00:00:00 2001 From: Vladimir Motylenko Date: Fri, 8 Oct 2021 15:54:31 +0300 Subject: [PATCH] fix(velas-ccount): Fix velas account storage key finding method. --- core/src/rpc.rs | 8 +++++--- programs/velas-account-program/src/lib.rs | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/rpc.rs b/core/src/rpc.rs index 8f8fd43b6d..13331da938 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -4030,10 +4030,12 @@ pub mod rpc_full { ); let accounts = storages + .expect("velas account operational index to be activated") .into_iter() - .flatten() - .flat_map(|(storage, _)| meta.get_velas_accounts_by_storage_key(&bank, storage)) - .flatten(); + .flat_map(|(storage, _)| { + meta.get_velas_accounts_by_storage_key(&bank, storage) + .expect("velas account storage index to be activated") + }); debug!( "get_velas_accounts_by_operational_key velas accounts {:?}", accounts diff --git a/programs/velas-account-program/src/lib.rs b/programs/velas-account-program/src/lib.rs index a9eb06010c..74b0a6a4af 100644 --- a/programs/velas-account-program/src/lib.rs +++ b/programs/velas-account-program/src/lib.rs @@ -38,12 +38,14 @@ pub struct VAccountInfo { } impl VAccountInfo { + const SUFFIX_OPERATIONAL_STORAGE: &'static [u8] = b"operationals"; + pub fn find_storage_key(&self, vaccount: &Pubkey) -> Pubkey { Pubkey::find_program_address( &[ &vaccount.to_bytes(), - b"storage", - &self.programs_storage_nonce.to_le_bytes(), + Self::SUFFIX_OPERATIONAL_STORAGE, + &self.operational_storage_nonce.to_le_bytes(), ], &crate::id(), )