Implement a forked sort package from go1.13 for stable masternode sorting #489
+2,131
−1
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.
Description
This PR addresses the issue of ensuring stable sorting of masternodes across different Go versions. To achieve this, we have forked the sort package from Go 1.13 and implemented it specifically for the masternode sorting algorithm.
The forked sort package guarantees consistent behavior, providing stability and reliability in the sorting process regardless of the underlying Go version.
Changes
Utility Functions:
common/sort/slice.go
.common/sort/sort.go
.common/sort/slice_go113.go
.common/sort/genzfunc.go
.common/sort/zfuncversion.go
.Import Changes:
core/blockchain.go
: Updated import statement to use the newsort
package fromgithub.com/tomochain/tomochain/common/sort
.Tests:
common/sort/example_interface_test.go
.common/sort/example_keys_test.go
.common/sort/example_multi_test.go
.common/sort/example_test.go
.common/sort/example_wrapper_test.go
.common/sort/export_test.go
.common/sort/sort_test.go
.Impact
This change ensures: