Skip to content
Snippets Groups Projects

Fix account linking

Merged Benjamin Gallois requested to merge bgallois/duniter-v2s:153-linking into master
Compare and
1 file
+ 34
0
Compare changes
  • Side-by-side
  • Inline
@@ -1306,3 +1306,37 @@ fn smith_data_problem() {
run_to_block(4);
});
}
/// test killed account
// The only way to kill an account is to kill the identity
// and transfer all funds.
#[test]
fn test_killed_account() {
ExtBuilder::new(1, 2, 4)
.with_initial_balances(vec![(AccountKeyring::Bob.to_account_id(), 1_000)])
.build()
.execute_with(|| {
let alice_account = AccountKeyring::Alice.to_account_id();
let bob_account = AccountKeyring::Bob.to_account_id();
// check that Alice is 1 and Bob 2
assert_eq!(Identity::identity_index_of(&alice_account), Some(1));
assert_eq!(Identity::identity_index_of(&bob_account), Some(2));
let _ = Identity::do_remove_identity(2, pallet_identity::RemovalReason::Revoked);
assert_eq!(
frame_system::Pallet::<Runtime>::get(&bob_account).linked_idty,
Some(2)
);
assert_ok!(Balances::transfer_all(
frame_system::RawOrigin::Signed(bob_account.clone()).into(),
sp_runtime::MultiAddress::Id(alice_account.clone()),
false
));
// Bob account should have been reaped
assert_eq!(
frame_system::Pallet::<Runtime>::get(&bob_account),
pallet_duniter_account::AccountData::default()
);
})
}
Loading