-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix the cancel unbond #12967
Merged
Merged
fix: fix the cancel unbond #12967
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f560e44
fix: fix the cancel-unbond issue
gsk967 3d7a8f1
Merge branch 'main' into sai/fix_12931
gsk967 9d2f122
updated the changelog
gsk967 fd7affc
chroe: removed un wanted code
gsk967 9393857
chore: removed max ubd entries check
gsk967 0c3abf9
chore: add max entries check for ubd
gsk967 fbbf1ef
chore: address the pr comments
gsk967 3802ec4
Merge branch 'main' into sai/fix_12931
gsk967 eef238b
chore: address the pr comments
gsk967 f1e6b20
Merge branch 'main' into sai/fix_12931
gsk967 61b1d1c
Merge branch 'main' into sai/fix_12931
gsk967 d9ff332
chore: address the pr comments++
gsk967 0ab51d6
Merge branch 'main' into sai/fix_12931
alexanderbez 1a008ba
Merge branch 'main' into sai/fix_12931
alexanderbez 505b263
Merge branch 'main' into sai/fix_12931
gsk967 184bfd8
chore: address the pr comments ++
gsk967 6986d14
Merge branch 'main' into sai/fix_12931
gsk967 1cc4806
test: add store migrations
gsk967 62498a3
chore: small fix
gsk967 c6654a8
chore: address the review comments++
gsk967 eb38e0e
Merge branch 'main' into sai/fix_12931
amaury1093 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,8 +130,27 @@ func NewUnbondingDelegation( | |
|
||
// AddEntry - append entry to the unbonding delegation | ||
func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance math.Int) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's add a unit test for this function |
||
entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) | ||
ubd.Entries = append(ubd.Entries, entry) | ||
// Check the entries exists with creation_height and complete_time | ||
entryIndex := -1 | ||
for index, ubdEntry := range ubd.Entries { | ||
if ubdEntry.CreationHeight == creationHeight && ubdEntry.CompletionTime.Equal(minTime) { | ||
entryIndex = index | ||
break | ||
} | ||
} | ||
// entryIndex exists | ||
if entryIndex != -1 { | ||
ubdEntry := ubd.Entries[entryIndex] | ||
ubdEntry.Balance = ubdEntry.Balance.Add(balance) | ||
ubdEntry.InitialBalance = ubdEntry.InitialBalance.Add(balance) | ||
amaury1093 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// update the entry | ||
ubd.Entries[entryIndex] = ubdEntry | ||
} else { | ||
// append the new unbond delegation entry | ||
entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) | ||
ubd.Entries = append(ubd.Entries, entry) | ||
} | ||
atheeshp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// RemoveEntry - remove entry at index i to the unbonding delegation | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update this godoc too