sdk/solana: post_message: added multiple seeds. (#838)

This commit is contained in:
Serguei 2022-03-03 12:23:56 -06:00 committed by GitHub
parent 4bc5daa8d1
commit 087506dec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -86,7 +86,7 @@ pub fn post_message(
message: Pubkey,
payload: impl AsRef<[u8]>,
consistency: ConsistencyLevel,
seeds: Option<&[&[u8]]>,
pda_seeds: Option<&[&[&[u8]]]>,
accounts: &[AccountInfo],
nonce: u32,
) -> ProgramResult {
@ -103,6 +103,11 @@ pub fn post_message(
let config = accounts.iter().find(|item| *item.key == config).unwrap();
let config = read_config(config).unwrap();
let mut seeds = vec![&*emitter_seeds];
if let Some(v) = pda_seeds {
seeds.extend(v);
}
// Pay Fee to the Wormhole
invoke_signed(
&solana_program::system_instruction::transfer(
@ -127,7 +132,7 @@ pub fn post_message(
)
.unwrap(),
accounts,
&[&emitter_seeds, seeds.unwrap_or(&[])],
&seeds
)?;
Ok(())