mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 12:37:57 +00:00
[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:
@@ -614,8 +614,13 @@ fn transfer_owner_should_work() {
|
||||
Nfts::transfer_ownership(RuntimeOrigin::signed(account(1)), 0, account(2)),
|
||||
Error::<Test>::Unaccepted
|
||||
);
|
||||
assert_eq!(System::consumers(&account(2)), 0);
|
||||
|
||||
assert_ok!(Nfts::set_accept_ownership(RuntimeOrigin::signed(account(2)), Some(0)));
|
||||
assert_eq!(System::consumers(&account(2)), 1);
|
||||
|
||||
assert_ok!(Nfts::transfer_ownership(RuntimeOrigin::signed(account(1)), 0, account(2)));
|
||||
assert_eq!(System::consumers(&account(2)), 1); // one consumer is added due to deposit repatriation
|
||||
|
||||
assert_eq!(collections(), vec![(account(2), 0)]);
|
||||
assert_eq!(Balances::total_balance(&account(1)), 98);
|
||||
|
||||
Reference in New Issue
Block a user