[NFTs] Fix consumers issue (#2653)

When we call the `set_accept_ownership` method, we increase the number
of account consumers, but then we don't decrease it on collection
transfer, which leads to the wrong consumers number an account has.
This commit is contained in:
Jegor Sidorenko
2023-12-19 15:23:58 +02:00
committed by GitHub
parent 0b74812ce8
commit 166ae5ae12
5 changed files with 33 additions and 21 deletions
+3
View File
@@ -254,8 +254,11 @@ fn transfer_owner_should_work() {
Uniques::transfer_ownership(RuntimeOrigin::signed(1), 0, 2),
Error::<Test>::Unaccepted
);
assert_eq!(System::consumers(&2), 0);
assert_ok!(Uniques::set_accept_ownership(RuntimeOrigin::signed(2), Some(0)));
assert_eq!(System::consumers(&2), 1);
assert_ok!(Uniques::transfer_ownership(RuntimeOrigin::signed(1), 0, 2));
assert_eq!(System::consumers(&2), 1);
assert_eq!(collections(), vec![(2, 0)]);
assert_eq!(Balances::total_balance(&1), 98);