Allow the emitter to be mutable

This is the case when the emitter is the fee payer.

Change-Id: Ib21658c6cbbbb246a7434057c0f03f24bec8c013
This commit is contained in:
Hendrik Hofstadt 2021-08-23 14:25:53 +02:00
parent 254f1c8674
commit 72477c46a4
2 changed files with 4 additions and 5 deletions

View File

@ -134,14 +134,13 @@ fn command_post_message(
fee,
);
let emitter = Keypair::new();
let message = Keypair::new();
let ix = match proxy {
Some(p) => cpi_poster::instructions::post_message(
p,
*bridge,
config.owner.pubkey(),
emitter.pubkey(),
config.owner.pubkey(),
message.pubkey(),
nonce,
payload,
@ -151,7 +150,7 @@ fn command_post_message(
None => bridge::instructions::post_message(
*bridge,
config.owner.pubkey(),
emitter.pubkey(),
config.owner.pubkey(),
message.pubkey(),
nonce,
payload,
@ -165,7 +164,7 @@ fn command_post_message(
let (recent_blockhash, fee_calculator) = config.rpc_client.get_recent_blockhash()?;
check_fee_payer_balance(config, fee_calculator.calculate_fee(&transaction.message()))?;
transaction.sign(
&[&config.fee_payer, &config.owner, &emitter, &message],
&[&config.fee_payer, &config.owner, &message],
recent_blockhash,
);
Ok(Some(transaction))

View File

@ -43,7 +43,7 @@ pub struct PostMessage<'b> {
pub message: Signer<Mut<UninitializedMessage<'b>>>,
/// Emitter of the VAA
pub emitter: Signer<Info<'b>>,
pub emitter: Signer<MaybeMut<Info<'b>>>,
/// Tracker for the emitter sequence
pub sequence: Mut<Sequence<'b>>,