Implement the same interface in all builtin programs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//! system program
|
||||
|
||||
use bincode::deserialize;
|
||||
use program::ProgramError;
|
||||
use solana_sdk::account::Account;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::system_instruction::SystemInstruction;
|
||||
@@ -99,6 +100,17 @@ pub fn process_instruction(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process(
|
||||
tx: &Transaction,
|
||||
instruction_index: usize,
|
||||
accounts: &mut [&mut Account],
|
||||
) -> std::result::Result<(), ProgramError> {
|
||||
process_instruction(&tx, instruction_index, accounts).map_err(|err| match err {
|
||||
Error::ResultWithNegativeTokens => ProgramError::ResultWithNegativeTokens,
|
||||
_ => ProgramError::RuntimeError,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
Reference in New Issue
Block a user