Add account accessor

This commit is contained in:
Armani Ferrante 2021-02-01 06:52:55 -08:00
parent bba2771962
commit 056e33370b
No known key found for this signature in database
GPG Key ID: D597A80BCF8E12B7
2 changed files with 7 additions and 1 deletions

View File

@ -72,7 +72,7 @@ pub mod multisig {
pub fn set_owners(ctx: Context<Auth>, owners: Vec<Pubkey>) -> Result<()> {
let multisig = &mut ctx.accounts.multisig;
if owners.len() as u64 > multisig.threshold {
if (owners.len() as u64) < multisig.threshold {
multisig.threshold = owners.len() as u64;
}

View File

@ -16,6 +16,12 @@ pub struct ProgramAccount<'info, T: AccountSerialize + AccountDeserialize + Clon
inner: Box<Inner<'info, T>>,
}
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ProgramAccount<'info, T> {
pub fn account(&self) -> &T {
&self.inner.account
}
}
#[derive(Clone)]
struct Inner<'info, T: AccountSerialize + AccountDeserialize + Clone> {
info: AccountInfo<'info>,