diff --git a/libraries/chain/include/graphene/chain/is_authorized_asset.hpp b/libraries/chain/include/graphene/chain/is_authorized_asset.hpp index 1c7569c0..5062136e 100644 --- a/libraries/chain/include/graphene/chain/is_authorized_asset.hpp +++ b/libraries/chain/include/graphene/chain/is_authorized_asset.hpp @@ -29,11 +29,26 @@ class account_object; class asset_object; class database; +namespace detail { + +bool _is_authorized_asset(const database& d, const account_object& acct, const asset_object& asset_obj); + +} + /** * @return true if the account is whitelisted and not blacklisted to transact in the provided asset; false * otherwise. */ -bool is_authorized_asset(const database& d, const account_object& acct, const asset_object& asset_obj); +inline bool is_authorized_asset(const database& d, const account_object& acct, const asset_object& asset_obj) +{ + bool fast_check = !(asset_obj.options.flags & white_list); + + if( fast_check ) + return true; + + bool slow_check = detail::_is_authorized_asset( d, acct, asset_obj ); + return slow_check; +} } } diff --git a/libraries/chain/is_authorized_asset.cpp b/libraries/chain/is_authorized_asset.cpp index 0dda6ece..585b1da6 100644 --- a/libraries/chain/is_authorized_asset.cpp +++ b/libraries/chain/is_authorized_asset.cpp @@ -30,7 +30,9 @@ namespace graphene { namespace chain { -bool is_authorized_asset( +namespace detail { + +bool _is_authorized_asset( const database& d, const account_object& acct, const asset_object& asset_obj) @@ -62,4 +64,6 @@ bool is_authorized_asset( return false; } -} } +} // detail + +} } // graphene::chain