Programs can only sign their accounts

This commit is contained in:
Jack May
2020-05-08 12:24:36 -07:00
parent b4b4d6b00d
commit 97e17f9b32
10 changed files with 187 additions and 100 deletions

View File

@@ -262,7 +262,9 @@ mod tests {
use std::{cell::RefCell, fs::File, io::Read, ops::Range, rc::Rc};
#[derive(Debug, Default)]
pub struct MockInvokeContext {}
pub struct MockInvokeContext {
key: Pubkey,
}
impl InvokeContext for MockInvokeContext {
fn push(&mut self, _key: &Pubkey) -> Result<(), InstructionError> {
Ok(())
@@ -277,6 +279,9 @@ mod tests {
) -> Result<(), InstructionError> {
Ok(())
}
fn get_caller(&self) -> Result<&Pubkey, InstructionError> {
Ok(&self.key)
}
}
#[test]