Skip to content

Commit ad0d643

Browse files
committed
fix: batched address tree init assert tree and queue index are the same
1 parent b5f7f10 commit ad0d643

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

programs/system/src/processor/create_address_cpi_data.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ pub fn derive_new_addresses<'info, 'a, 'b: 'a, const ADDRESS_ASSIGNMENT: bool>(
8383
tree.queue_batches.next_index,
8484
);
8585

86+
// For batched address trees the queue is embedded in the tree
87+
// account so both indices must point to the same account.
88+
if new_address_params.address_queue_index()
89+
!= new_address_params.address_merkle_tree_account_index()
90+
{
91+
return Err(ProgramError::from(
92+
SystemProgramError::AddressMerkleTreeAccountDiscriminatorMismatch,
93+
));
94+
}
95+
8696
(
8797
derive_address(
8898
&new_address_params.seed(),

0 commit comments

Comments
 (0)