Skip to content

Commit

Permalink
Fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrug-rdx committed Feb 6, 2024
1 parent 2335188 commit 2f43c34
Showing 1 changed file with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,33 @@ impl ManifestSummaryCallback for PresentedProofsDetector {
resource: &ResourceSpecifier,
) {
self.presented_proofs.entry(*account).and_modify(|item| {
if let Some(res) = item.iter().find(|res| {
res.resource_address() == resource.resource_address()
}) {
if let Some((idx, res)) =
item.iter().enumerate().find(|(_, res)| {
res.resource_address() == resource.resource_address()
})
{
match res {
ResourceSpecifier::Amount(_, mut amount) => {
match resource {
ResourceSpecifier::Amount(_, new_amount) => {
amount = amount
ResourceSpecifier::Amount(address, amount) => {
if let ResourceSpecifier::Amount(_, new_amount) =
resource
{
item[idx] = ResourceSpecifier::Amount(
*address,
amount
.checked_add(*new_amount)
.expect("Overflow");
}
ResourceSpecifier::Ids(_, _) => (),
.expect("Overflow"),
)
}
}
ResourceSpecifier::Ids(_, mut ids) => match resource {
ResourceSpecifier::Amount(_, _) => (),
ResourceSpecifier::Ids(_, new_ids) => {
ids.extend(new_ids.clone());
ResourceSpecifier::Ids(address, ids) => {
if let ResourceSpecifier::Ids(_, ids_to_add) = resource
{
let mut new_ids = ids.clone();
new_ids.extend(ids_to_add.clone());
item[idx] =
ResourceSpecifier::Ids(*address, new_ids);
}
},
}
}
} else {
item.push(resource.clone());
Expand Down

0 comments on commit 2f43c34

Please sign in to comment.