From d134c5313726371b16c9576ee0ee5b7941ff53d5 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Tue, 22 Feb 2022 10:31:04 -0500 Subject: [PATCH] Forbid current inviters from being renamed. An invition implies recent activity, so this is not a significant limitation. --- contracts/eden/src/inductions.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/contracts/eden/src/inductions.cpp b/contracts/eden/src/inductions.cpp index dc8264a00..b5f6d12f0 100644 --- a/contracts/eden/src/inductions.cpp +++ b/contracts/eden/src/inductions.cpp @@ -450,18 +450,10 @@ namespace eden [&](auto& endorsement) { endorsement.endorser() = new_account; }); iter = next; } - // change all inductions with old_account as inviter auto inviter_idx = induction_tb.get_index<"byinviter"_n>(); - for (auto iter = inviter_idx.lower_bound(combine_names(old_account, ""_n)), - end = inviter_idx.end(); - iter != end && iter->inviter() == old_account;) - { - auto next = iter; - ++next; - inviter_idx.modify(iter, contract, - [&](auto& invitation) { invitation.inviter() = new_account; }); - iter = next; - } + auto iter = inviter_idx.lower_bound(combine_names(old_account, ""_n)); + eosio::check(iter == inviter_idx.end() || iter->inviter() != old_account, + "Cannot rename an account that is the inviter of a pending invitation"); } void inductions::clear_all()