sdk: Add accessor for signer pubkeys of a tx message

This commit is contained in:
Trent Nelson 2021-03-15 20:41:53 -06:00 committed by Trent Nelson
parent d9176c1903
commit bf33ce8906
1 changed files with 9 additions and 0 deletions

View File

@ -439,6 +439,15 @@ impl Message {
accounts,
})
}
pub fn signer_keys(&self) -> Vec<&Pubkey> {
// Clamp in case we're working on un-`sanitize()`ed input
let last_key = self
.account_keys
.len()
.max(self.header.num_required_signatures as usize);
self.account_keys[..last_key].iter().collect()
}
}
#[cfg(test)]