Skip to content
Snippets Groups Projects
Unverified Commit 84d6342c authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

pallet-uniques/nfts: Small optimizations (#2754)

Use `contains_key` to not require decoding the actual value.
parent 7c79741e
Branches
No related merge requests found
Pipeline #427555 canceled with stages
in 14 minutes and 4 seconds
......@@ -173,8 +173,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
who: T::AccountId,
maybe_collection: Option<T::CollectionId>,
) -> DispatchResult {
let old = OwnershipAcceptance::<T, I>::get(&who);
match (old.is_some(), maybe_collection.is_some()) {
let exists = OwnershipAcceptance::<T, I>::contains_key(&who);
match (exists, maybe_collection.is_some()) {
(false, true) => {
frame_system::Pallet::<T>::inc_consumers(&who)?;
},
......
......@@ -1433,8 +1433,8 @@ pub mod pallet {
maybe_collection: Option<T::CollectionId>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
let old = OwnershipAcceptance::<T, I>::get(&who);
match (old.is_some(), maybe_collection.is_some()) {
let exists = OwnershipAcceptance::<T, I>::contains_key(&who);
match (exists, maybe_collection.is_some()) {
(false, true) => {
frame_system::Pallet::<T>::inc_consumers(&who)?;
},
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment