mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
Optimize bestFilterHeaderHeightQuery (#5223)
This commit is contained in:
parent
c038d2fa3b
commit
0e2fddcc57
@ -156,13 +156,14 @@ case class CompactFilterHeaderDAO()(implicit
|
||||
safeDatabase.run(bestFilterHeaderQuery).map(_.headOption)
|
||||
}
|
||||
|
||||
private val bestFilterHeaderHeightQuery = {
|
||||
bestFilterHeaderQuery.map(_.headOption.map(_.height))
|
||||
private val bestFilterHeaderHeightQuery: Rep[Option[Int]] = {
|
||||
table.map(_.height).max
|
||||
}
|
||||
|
||||
def getBestFilterHeaderHeight: Future[Int] = {
|
||||
safeDatabase.run(bestFilterHeaderHeightQuery).map { filterHeaderHeightOpt =>
|
||||
filterHeaderHeightOpt.getOrElse(0)
|
||||
safeDatabase.run(bestFilterHeaderHeightQuery.result).map {
|
||||
filterHeaderHeightOpt =>
|
||||
filterHeaderHeightOpt.getOrElse(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user