reestablish parameter semantics for withdraw (#6330)

This commit is contained in:
Rob Walker
2019-10-14 15:02:24 -07:00
committed by GitHub
parent 3313b2ff58
commit c2ebf466fd
4 changed files with 198 additions and 219 deletions

View File

@ -1,6 +1,6 @@
use crate::hash::Hash;
use crate::{clock::Epoch, pubkey::Pubkey};
use std::{cmp, fmt};
use std::{cmp, fmt, iter::FromIterator};
/// An Account with data that is stored on chain
#[repr(C)]
@ -196,3 +196,15 @@ pub fn create_keyed_credit_only_accounts(accounts: &mut [(Pubkey, Account)]) ->
})
.collect()
}
/// Return all the signers from a set of KeyedAccounts
pub fn get_signers<A>(keyed_accounts: &[KeyedAccount]) -> A
where
A: FromIterator<Pubkey>,
{
keyed_accounts
.iter()
.filter_map(|keyed_account| keyed_account.signer_key())
.cloned()
.collect::<A>()
}

View File

@ -1,6 +1,4 @@
use crate::account::KeyedAccount;
use crate::instruction::InstructionError;
use crate::pubkey::Pubkey;
use crate::{account::KeyedAccount, instruction::InstructionError, pubkey::Pubkey};
use num_traits::{FromPrimitive, ToPrimitive};
// All native programs export a symbol named process()