Skip to content

Commit

Permalink
Fix future rights schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Jul 20, 2020
1 parent d067dcb commit d4eb53b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Tzkt.Api/Repositories/BakingRightsRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ public async Task<IEnumerable<BakingInterval>> GetSchedule(string address, DateT
var proto = Protocols.Current;

var rawAccount = await Accounts.GetAsync(address);
var fromLevel = Time.FindLevel(from, Nearest.Higher);

var fromLevel = from > state.Timestamp
? state.Level + (int)(from - state.Timestamp).TotalSeconds / proto.TimeBetweenBlocks
: Time.FindLevel(from, Nearest.Higher);

var toLevel = to > state.Timestamp
? state.Level + (int)(to - state.Timestamp).TotalSeconds / proto.TimeBetweenBlocks
: Time.FindLevel(to, Nearest.Lower);
Expand Down

0 comments on commit d4eb53b

Please sign in to comment.