Skip to content

Commit

Permalink
limit time extension to 1 year
Browse files Browse the repository at this point in the history
  • Loading branch information
n13 committed Aug 14, 2024
1 parent 0bb1057 commit 671dda8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2986,6 +2986,10 @@ void dao::genPeriods(const std::string& owner, int64_t periodDuration, uint64_t
.getStartTime()
.sec_since_epoch();

if (limitTimeExtension) {
if (lastPeriodStartSecs + periodDuration) > 365 * 24 * 60 * 60
}

for (int64_t i = 0; i < std::min(MAX_PERIODS_PER_CALL, periodCount); ++i) {
time_point nextPeriodStart(eosio::seconds(lastPeriodStartSecs + periodDuration));

Expand All @@ -3006,6 +3010,8 @@ void dao::genPeriods(const std::string& owner, int64_t periodDuration, uint64_t
Edge(get_self(), get_self(), calendarId, lastPeriodID, common::END);

//Check if there are more periods to created
// Note Nik: This makes very little sense since this is an inline action so it will timeout the entire
// transaction if it exceeds the time limit.
if (periodCount > MAX_PERIODS_PER_CALL) {
eosio::action(
eosio::permission_level(get_self(), eosio::name("active")),
Expand Down

0 comments on commit 671dda8

Please sign in to comment.