difftreelog
fix unable to destroy collection with nested tokens
in: master
1 file changed
pallets/nonfungible/src/lib.rsdiffbeforeafterboth79 NonfungibleItemsHaveNoAmount,79 NonfungibleItemsHaveNoAmount,80 /// Unable to burn NFT with children80 /// Unable to burn NFT with children81 CantBurnNftWithChildren,81 CantBurnNftWithChildren,82 /// Unable to burn a collection containing NFTs that have children83 CantBurnCollectionWithNestedTokens82 }84 }838584 #[pallet::config]86 #[pallet::config]293 ) -> DispatchResult {295 ) -> DispatchResult {294 let id = collection.id;296 let id = collection.id;297298 if Self::collection_has_nested_tokens(id) {299 return Err(<Error<T>>::CantBurnCollectionWithNestedTokens.into());300 }295301296 // =========302 // =========297303966 );972 );967 }973 }974975 fn collection_has_nested_tokens(collection_id: CollectionId) -> bool {976 <TokenChildren<T>>::iter_prefix((collection_id,)).next().is_some()977 }968978969 fn token_has_children(collection_id: CollectionId, token_id: TokenId) -> bool {979 fn token_has_children(collection_id: CollectionId, token_id: TokenId) -> bool {970 <TokenChildren<T>>::iter_prefix((collection_id, token_id)).next().is_some()980 <TokenChildren<T>>::iter_prefix((collection_id, token_id)).next().is_some()