examples/lockup: Disallow vesting accounts with invalid periods

This commit is contained in:
Armani Ferrante 2021-01-30 05:59:51 -08:00
parent f0297012c6
commit a078b683b8
No known key found for this signature in database
GPG Key ID: D597A80BCF8E12B7
1 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,9 @@ pub mod lockup {
if end_ts <= ctx.accounts.clock.unix_timestamp {
return Err(ErrorCode::InvalidTimestamp.into());
}
if period_count > (end_ts - ctx.accounts.clock.unix_timestamp) as u64 {
return Err(ErrorCode::InvalidPeriod.into());
}
if period_count == 0 {
return Err(ErrorCode::InvalidPeriod.into());
}