mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
pallet-uniques/nfts: Small optimizations (#2754)
Use `contains_key` to not require decoding the actual value.
This commit is contained in:
@@ -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)?;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user