Skip to content

Commit

Permalink
Fix order of inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
gostkin committed Dec 7, 2023
1 parent e396a8b commit e42c0ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion indexer/tasks/src/multiera/multiera_projected_nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use pallas::ledger::primitives::Fragment;
use pallas::ledger::traverse::{Asset, MultiEraOutput, MultiEraTx};
use projected_nft_sdk::{Owner, Redeem, State, Status};
use sea_orm::{FromQueryResult, JoinType, QuerySelect, QueryTrait};
use std::cmp::Ordering;
use std::collections::{BTreeSet, HashMap, HashSet};
use std::fmt::format;

Expand Down Expand Up @@ -423,7 +424,14 @@ fn handle_claims_and_partial_withdraws(
) -> BTreeMap<Vec<u8>, BTreeMap<i64, Vec<ProjectedNftInputsQueryOutputResult>>> {
let mut partially_withdrawn = BTreeMap::new();

for (input_index, input) in tx_body.inputs().iter().enumerate() {
let mut sorted_inputs = tx_body.inputs();
sorted_inputs.sort_by(|left, right| match left.hash().cmp(right.hash()) {
Ordering::Less => Ordering::Less,
Ordering::Equal => left.index().cmp(&right.index()),
Ordering::Greater => Ordering::Greater,
});

for (input_index, input) in sorted_inputs.iter().enumerate() {
let entry = if let Some(entry) = used_projected_nfts.get(&input.hash().to_vec()) {
entry
} else {
Expand Down

0 comments on commit e42c0ad

Please sign in to comment.