From 887f5eeee9e08efe7a84d5f3c046f3f7595f08ab Mon Sep 17 00:00:00 2001 From: Kasey White Date: Thu, 3 Nov 2022 05:04:21 -0400 Subject: [PATCH] sorts inputs for sc --- crates/uplc/src/tx/eval.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/uplc/src/tx/eval.rs b/crates/uplc/src/tx/eval.rs index 94d44dce..877adebb 100644 --- a/crates/uplc/src/tx/eval.rs +++ b/crates/uplc/src/tx/eval.rs @@ -239,8 +239,8 @@ fn get_tx_info_v1( return Err(Error::ScriptAndInputRefNotAllowed); } - let inputs = get_tx_in_info_v1(&body.inputs, utxos)?; - + let mut inputs = get_tx_in_info_v1(&body.inputs, utxos)?; + inputs.sort_by(|x, y| x.out_ref.cmp(&y.out_ref)); let outputs = body .outputs .iter() @@ -298,7 +298,9 @@ fn get_tx_info_v2( ) -> Result { let body = tx.transaction_body.clone(); - let inputs = get_tx_in_info_v2(&body.inputs, utxos)?; + let mut inputs = get_tx_in_info_v2(&body.inputs, utxos)?; + inputs.sort_by(|x, y| x.out_ref.cmp(&y.out_ref)); + let reference_inputs = get_tx_in_info_v2(&body.reference_inputs.clone().unwrap_or_default(), utxos)?; let outputs = body