File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
scorex-transaction/src/main/scala/scorex/api/http
src/test/scala/scorex/lagonaki/integration/api Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,8 @@ case class BlocksApiRoute(override val application: Application)(implicit val co
135
135
case blockchain : BlockChain =>
136
136
JsArray (
137
137
(start to end).map { height =>
138
- blockchain.blockAt(height).map(_.json).getOrElse(Json .obj(" error" -> s " No block at height $height" ))
138
+ blockchain.blockAt(height).map(_.json + (" height" -> Json .toJson(height)))
139
+ .getOrElse(Json .obj(" error" -> s " No block at height $height" ))
139
140
})
140
141
case _ =>
141
142
Json .obj(" status" -> " error" , " details" -> " Not available for other option than linear blockchain" )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class BlockAPISpecification extends FunSuite with Matchers with TransactionTesti
14
14
val history = application.blockStorage.history
15
15
val genesis = history.genesis
16
16
17
- if (history.height() < 2 ) {
17
+ while (history.height() < 3 ) {
18
18
application.blockStorage.appendBlock(genValidBlock())
19
19
}
20
20
val last = history.lastBlock
@@ -28,6 +28,8 @@ class BlockAPISpecification extends FunSuite with Matchers with TransactionTesti
28
28
val response = GET .request(s " /blocks/seq/1/3 " )
29
29
checkGenesis(response(0 ).as[JsValue ])
30
30
checkBlock(response(1 ).as[JsValue ])
31
+ (response(1 ) \ " height" ).as[Int ] shouldBe 2
32
+ (response(2 ) \ " height" ).as[Int ] shouldBe 3
31
33
}
32
34
33
35
test(" GET /blocks/last API route" ) {
You can’t perform that action at this time.
0 commit comments