From a72c671a9b3fa431636dee15d8d4a28df96b7577 Mon Sep 17 00:00:00 2001 From: Marco Granelli Date: Tue, 10 Sep 2024 21:57:47 +0200 Subject: [PATCH] Multitoken vp ensures debited accounts' vps are triggered --- crates/trans_token/src/vp.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/trans_token/src/vp.rs b/crates/trans_token/src/vp.rs index d4ac1e5ee8..1c175e3369 100644 --- a/crates/trans_token/src/vp.rs +++ b/crates/trans_token/src/vp.rs @@ -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 ))); } @@ -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");