aboutsummaryrefslogtreecommitdiffstats
path: root/core/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/utils.go')
-rw-r--r--core/utils.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/utils.go b/core/utils.go
index d023d2e..6b03f93 100644
--- a/core/utils.go
+++ b/core/utils.go
@@ -92,3 +92,14 @@ func getMedianTime(block *types.Block) (t time.Time, err error) {
return
}
+
+func removeFromSortedIntSlice(xs []int, x int) []int {
+ indexToRemove := sort.Search(len(xs), func(idx int) bool {
+ return xs[idx] >= x
+ })
+ if indexToRemove == len(xs) || xs[indexToRemove] != x {
+ // This value is not found.
+ return xs
+ }
+ return append(xs[:indexToRemove], xs[indexToRemove+1:]...)
+}