Skip to content

Commit

Permalink
fix: Fix LowestExpireHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
OnedgeLee committed Jan 3, 2025
1 parent 40d8848 commit 0fbc57d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Lib9c/Delegation/IUnbonding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IUnbonding

Address DelegatorAddress { get; }

long LowestExpireHeight { get; }
long? LowestExpireHeight { get; }

bool IsFull { get; }

Expand Down
4 changes: 3 additions & 1 deletion Lib9c/Delegation/RebondGrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ private RebondGrace(

public IDelegationRepository? Repository => _repository;

public long LowestExpireHeight => Entries.First().Key;
public long? LowestExpireHeight => IsEmpty
? null
: Entries.First().Key;

public bool IsFull => Entries.Values.Sum(e => e.Count) >= MaxEntries;

Expand Down
4 changes: 3 additions & 1 deletion Lib9c/Delegation/UnbondLockIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private UnbondLockIn(
// TODO: Use better custom collection type
public ImmutableSortedDictionary<long, ImmutableList<UnbondingEntry>> Entries { get; }

public long LowestExpireHeight => Entries.First().Key;
public long? LowestExpireHeight => IsEmpty
? null
: Entries.First().Key;

public bool IsFull => Entries.Values.Sum(e => e.Count) >= MaxEntries;

Expand Down

0 comments on commit 0fbc57d

Please sign in to comment.