Add next_keyed_account() to instruction_processor_utils (#6309)

* Cleanup KeyedArguments traversal

* Better error message

* Fix clippy warning

* Rename next_arg to next_keyed_account

* Fix clippy warning

* Shorter
This commit is contained in:
Greg Fitzgerald
2019-10-10 06:30:42 -06:00
committed by GitHub
parent 54d0168746
commit eca56eb87d
3 changed files with 20 additions and 20 deletions

View File

@ -67,6 +67,9 @@ pub enum InstructionError {
/// Rent_epoch account changed, but shouldn't have
RentEpochModified,
/// The instruction expected additional account keys
NotEnoughAccountKeys,
/// CustomError allows on-chain programs to implement program-specific error types and see
/// them returned by the Solana runtime. A CustomError may be any type that is represented
/// as or serialized to a u32 integer.

View File

@ -38,6 +38,11 @@ where
}
}
/// Return the next KeyedAccount or a NotEnoughAccountKeys instruction error
pub fn next_keyed_account<I: Iterator>(iter: &mut I) -> Result<I::Item, InstructionError> {
iter.next().ok_or(InstructionError::NotEnoughAccountKeys)
}
pub trait DecodeError<E> {
fn decode_custom_error_to_enum(custom: u32) -> Option<E>
where