Skip to content

Commit a7248ac

Browse files
committed
move the check above
1 parent 65c6f5a commit a7248ac

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

solana/programs/matching-engine/src/fallback/processor/initialize_fast_market_order.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ pub(super) fn process(
119119
// fast market order account.
120120
let payer_info = &accounts[0];
121121

122+
// These accounts will be used by the Verify VAA shim program.
123+
let from_endpoint = super::helpers::try_live_endpoint_account(&accounts[1], "from_endpoint")
124+
.map_err(|e: Error| e.with_account_name("from_endpoint"))?;
125+
126+
if fast_market_order.vaa_emitter_address != from_endpoint.address
127+
|| fast_market_order.vaa_emitter_chain != from_endpoint.chain
128+
{
129+
return Err(MatchingEngineError::InvalidEndpoint.into());
130+
}
131+
122132
// Verify the VAA digest with the Verify VAA shim program.
123133
super::helpers::invoke_verify_hash(
124134
2, // verify_vaa_shim_program_index
@@ -129,16 +139,6 @@ pub(super) fn process(
129139
accounts,
130140
)?;
131141

132-
// These accounts will be used by the Verify VAA shim program.
133-
let from_endpoint = super::helpers::try_live_endpoint_account(&accounts[2], "from_endpoint")
134-
.map_err(|e: Error| e.with_account_name("from_endpoint"))?;
135-
136-
if fast_market_order.vaa_emitter_address != from_endpoint.address
137-
|| fast_market_order.vaa_emitter_chain != from_endpoint.chain
138-
{
139-
return Err(MatchingEngineError::InvalidEndpoint.into());
140-
}
141-
142142
// Create the new fast market order account and serialize the instruction
143143
// data into it.
144144

0 commit comments

Comments
 (0)