Lower matcher (#478)
This commit is contained in:
Submodule emerald-grpc updated: ab1380831c...b95b142993
@@ -65,10 +65,18 @@ class Selector {
|
|||||||
}.run {
|
}.run {
|
||||||
MultiMatcher(this)
|
MultiMatcher(this)
|
||||||
}
|
}
|
||||||
val sort = selectors.firstOrNull { it.hasHeightSelector() && it.heightSelector.height == -1L }
|
return UpstreamFilter(getSort(selectors), matcher)
|
||||||
?.let { Sort(compareByDescending { it.getHead().getCurrentHeight() }) }
|
}
|
||||||
?: Sort.default
|
|
||||||
return UpstreamFilter(sort, matcher)
|
private fun getSort(selectors: List<BlockchainOuterClass.Selector>): Sort {
|
||||||
|
selectors.forEach { selector ->
|
||||||
|
if (selector.hasHeightSelector() && selector.heightSelector.height == -1L) {
|
||||||
|
return Sort(compareByDescending { it.getHead().getCurrentHeight() })
|
||||||
|
} else if (selector.hasLowerHeightSelector() && selector.lowerHeightSelector.height == 0L) {
|
||||||
|
return Sort(compareBy(nullsLast()) { it.getHead().getCurrentHeight() })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Sort.default
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|||||||
Reference in New Issue
Block a user