Skip to content

Commit

Permalink
Merge pull request #2110 from ergoplatform/i2106
Browse files Browse the repository at this point in the history
Fix for #2106 : MaxHeaders constant is used instead of epochLength related value in chainSlice limit
  • Loading branch information
kushti committed Feb 5, 2024
2 parents 7b37d84 + 044cd32 commit d5861e7
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ case class BlocksApiRoute(viewHolderRef: ActorRef, readersHolder: ActorRef, ergo
getModifierByIdR
}

private val maxHeadersInOneQuery = ergoSettings.chainSettings.epochLength * 2

private def getHistory: Future[ErgoHistoryReader] =
(readersHolder ? GetDataFromHistory[ErgoHistoryReader](r => r)).mapTo[ErgoHistoryReader]

Expand Down Expand Up @@ -105,7 +103,7 @@ case class BlocksApiRoute(viewHolderRef: ActorRef, readersHolder: ActorRef, ergo
val headers = maxHeaderOpt
.toIndexedSeq
.flatMap { maxHeader =>
history.headerChainBack(maxHeadersInOneQuery, maxHeader, _.height <= fromHeight + 1).headers
history.headerChainBack(MaxHeaders, maxHeader, _.height <= fromHeight + 1).headers
}
headers.toList.asJson
}
Expand Down

0 comments on commit d5861e7

Please sign in to comment.