From 1b238eae2e6a5ea1d0bd138197dbfb26fc6fea74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ba=C5=9Farcan=20Celebci?= Date: Fri, 4 Jan 2019 20:47:13 +0300 Subject: [PATCH] Add cancel deferred transaction in the checkRight instrument if minter is not the owner/whitelisted account --- contracts/ore.instrument/ore.instrument.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contracts/ore.instrument/ore.instrument.cpp b/contracts/ore.instrument/ore.instrument.cpp index 3c6b72a..ceffb41 100644 --- a/contracts/ore.instrument/ore.instrument.cpp +++ b/contracts/ore.instrument/ore.instrument.cpp @@ -188,11 +188,17 @@ void instrument::checkright(account_name minter, account_name issuer, string rig if (!minter_owns_right) { auto position_in_whitelist = std::find(rightitr.issuer_whitelist.begin(), rightitr.issuer_whitelist.end(), minter); - eosio_assert(position_in_whitelist != rightitr.issuer_whitelist.end(), "minter neither owns the right nor whitelisted for the right"); + if (position_in_whitelist == rightitr.issuer_whitelist.end()) + { + if (deferred_transaction_id != 0) + { + cancel_deferred(deferred_transaction_id); + } + eosio_assert(false, "minter neither owns the right nor whitelisted for the right"); + } } bool issuer_owns_right = rightitr.owner == issuer; - if (!issuer_owns_right) { auto issuer_in_whitelist = std::find(rightitr.issuer_whitelist.begin(), rightitr.issuer_whitelist.end(), issuer); @@ -202,7 +208,7 @@ void instrument::checkright(account_name minter, account_name issuer, string rig { cancel_deferred(deferred_transaction_id); } - eosio_assert(true, "instrument issuer neither holds the right nor whitelisted for the right"); + eosio_assert(false, "instrument issuer neither holds the right nor whitelisted for the right"); } } }