Skip to content

Commit

Permalink
Forbid current inviters from being renamed. An invition implies recen…
Browse files Browse the repository at this point in the history
…t activity, so this is not a significant limitation.
  • Loading branch information
swatanabe committed Feb 22, 2022
1 parent d63c4a9 commit d134c53
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions contracts/eden/src/inductions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d134c53

Please sign in to comment.