Created
November 22, 2023 18:43
-
-
Save kushti/64770e23ae54c532802a1994c4b5367c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.ergoplatform | |
import io.circe.jawn.JawnParser | |
import org.ergoplatform.http.api.ApiCodecs | |
import org.ergoplatform.modifiers.history.{BlockTransactions, BlockTransactionsSerializer} | |
import scorex.util.encode.Base16 | |
import java.io.File | |
object Checker5015 extends App with ApiCodecs { | |
val parser = new JawnParser | |
val bt = BlockTransactions.jsonDecoder.decodeJson(parser.parseFile(new File("bts.json")).toOption.get).toOption.get | |
val bytes = BlockTransactionsSerializer.toBytes(bt) | |
println(Base16.encode(bytes)) | |
val expectedBytes = Base16.decode(scala.io.Source.fromFile("bts.bytes").getLines.mkString("").trim).get | |
println(BlockTransactionsSerializer.parseBytesTry(expectedBytes).get == bt) | |
println(bt.id) | |
println(bt.transactions.map(_.id)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment