diff --git a/crates/core/transaction/src/plan.rs b/crates/core/transaction/src/plan.rs index 4d6a940fa5..4134c309eb 100644 --- a/crates/core/transaction/src/plan.rs +++ b/crates/core/transaction/src/plan.rs @@ -50,11 +50,19 @@ pub struct TransactionPlan { impl TransactionPlan { /// Sort the actions by type, using the protobuf field number in the [`Action`]. - pub fn sort_actions(mut actions: Vec) -> Vec { + pub fn sort_actions(&self, mut actions: Vec) -> Vec { actions.sort_by_key(|action: &Action| action.variant_index()); + actions } + /// Sort the action plans by type, using the protobuf field number in the [`ActionPlan`]. + pub fn sort_action_plans(&self, mut actions_plans: Vec) -> Vec { + actions_plans.sort_by_key(|action: &ActionPlan| action.variant_index()); + + actions_plans + } + /// Computes the [`EffectHash`] for the [`Transaction`] described by this /// [`TransactionPlan`]. /// diff --git a/crates/core/transaction/src/plan/build.rs b/crates/core/transaction/src/plan/build.rs index 88e14105e0..bbe725e25c 100644 --- a/crates/core/transaction/src/plan/build.rs +++ b/crates/core/transaction/src/plan/build.rs @@ -28,7 +28,7 @@ impl TransactionPlan { let detection_data = self.detection_data.as_ref().map(|x| x.detection_data()); // Implement canonical ordering to the actions to reduce client distinguishability. - actions = TransactionPlan::sort_actions(actions); + actions = self.sort_actions(actions); let transaction_body = TransactionBody { actions,