@@ -49,29 +49,33 @@ object KeyBlock {
4949 new KeyBlock (height, timestamp, previousKeyBlockHash, currentBlockHash, transactions, data, signature, scheduler, publicKey)
5050 }
5151
52- def toProtobuf (block : KeyBlock ): KeyBlockProtobuf = KeyBlockProtobuf ()
53- .withCurrentBlockHash(pByteString.copyFrom(block.currentBlockHash.toByteBuffer))
54- .withHeight(block.height)
55- .withTimestamp(block.timestamp)
56- .withTransactions(block.transactions.map(Transaction .toProtobuf))
57- .withData(pByteString.copyFrom(block.data.toByteBuffer))
58- .withSignature(pByteString.copyFrom(block.signature.toByteBuffer))
59- .withScheduler(block.scheduler.map(publicKey => pByteString.copyFrom(publicKey.toByteBuffer)))
60- .withPreviousKeyBlockHash(pByteString.copyFrom(block.previousKeyBlockHash.toByteBuffer))
61- .withPublicKey(pByteString.copyFrom(block.publicKey.toByteBuffer))
52+ def toProtobuf (block : KeyBlock ): KeyBlockProtobuf = {
53+ KeyBlockProtobuf ()
54+ .withCurrentBlockHash(pByteString.copyFrom(block.currentBlockHash.toByteBuffer))
55+ .withHeight(block.height)
56+ .withTimestamp(block.timestamp)
57+ .withTransactions(block.transactions.map(Transaction .toProtobuf))
58+ .withData(pByteString.copyFrom(block.data.toByteBuffer))
59+ .withSignature(pByteString.copyFrom(block.signature.toByteBuffer))
60+ .withScheduler(block.scheduler.map(publicKey => pByteString.copyFrom(publicKey.toByteBuffer)))
61+ .withPreviousKeyBlockHash(pByteString.copyFrom(block.previousKeyBlockHash.toByteBuffer))
62+ .withPublicKey(pByteString.copyFrom(block.publicKey.toByteBuffer))
63+ }
6264
6365
64- def fromProtobuf (blockProtobuf : KeyBlockProtobuf ): KeyBlock = KeyBlock (
65- blockProtobuf.height,
66- blockProtobuf.timestamp,
67- ByteString (blockProtobuf.previousKeyBlockHash.toByteArray),
68- ByteString (blockProtobuf.currentBlockHash.toByteArray),
69- blockProtobuf.transactions.map(Transaction .fromProtobuf).toList,
70- ByteString (blockProtobuf.data.toByteArray),
71- ByteString (blockProtobuf.signature.toByteArray),
72- blockProtobuf.scheduler.map(protKey => ByteString (protKey.toByteArray)).toList,
73- ByteString (blockProtobuf.publicKey.toByteArray)
74- )
66+ def fromProtobuf (blockProtobuf : KeyBlockProtobuf ): KeyBlock = {
67+ KeyBlock (
68+ blockProtobuf.height,
69+ blockProtobuf.timestamp,
70+ ByteString (blockProtobuf.previousKeyBlockHash.toByteArray),
71+ ByteString (blockProtobuf.currentBlockHash.toByteArray),
72+ blockProtobuf.transactions.map(Transaction .fromProtobuf).toList,
73+ ByteString (blockProtobuf.data.toByteArray),
74+ ByteString (blockProtobuf.signature.toByteArray),
75+ blockProtobuf.scheduler.map(protKey => ByteString (protKey.toByteArray)).toList,
76+ ByteString (blockProtobuf.publicKey.toByteArray)
77+ )
78+ }
7579}
7680
7781final case class MicroBlock (height : Long ,
0 commit comments