Skip to content

Commit

Permalink
Multitoken vp ensures debited accounts' vps are triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Sep 10, 2024
1 parent 6e4123e commit a72c671
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/trans_token/src/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ where
// Internal addresses need to always verify the transaction
// (credit and debit)
return Err(Error::new_alloc(format!(
"The vp of debited internal address {} has not been \
triggered",
"The vp of internal address {} has not been triggered",
owner
)));
}
Expand Down Expand Up @@ -147,6 +146,14 @@ where
"Native token deposit isn't allowed",
));
}
if !verifiers.contains(owner) {
// Debit must be verified by the controlling vp
return Err(Error::new_alloc(format!(
"The vp of debited address {} has not been \
triggered",
owner
)));
}
let diff = pre
.checked_sub(post)
.expect("Underflow shouldn't happen here");
Expand Down

0 comments on commit a72c671

Please sign in to comment.