Add account accessor
This commit is contained in:
parent
bba2771962
commit
056e33370b
|
@ -72,7 +72,7 @@ pub mod multisig {
|
||||||
pub fn set_owners(ctx: Context<Auth>, owners: Vec<Pubkey>) -> Result<()> {
|
pub fn set_owners(ctx: Context<Auth>, owners: Vec<Pubkey>) -> Result<()> {
|
||||||
let multisig = &mut ctx.accounts.multisig;
|
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;
|
multisig.threshold = owners.len() as u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,12 @@ pub struct ProgramAccount<'info, T: AccountSerialize + AccountDeserialize + Clon
|
||||||
inner: Box<Inner<'info, T>>,
|
inner: Box<Inner<'info, T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ProgramAccount<'info, T> {
|
||||||
|
pub fn account(&self) -> &T {
|
||||||
|
&self.inner.account
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Inner<'info, T: AccountSerialize + AccountDeserialize + Clone> {
|
struct Inner<'info, T: AccountSerialize + AccountDeserialize + Clone> {
|
||||||
info: AccountInfo<'info>,
|
info: AccountInfo<'info>,
|
||||||
|
|
Loading…
Reference in New Issue