Add module.BlockDataToBytes utility function
package module
import (
+ "bytes"
"io"
"github.com/icon-project/goloop/common/db"
@@ -36,6 +37,12 @@ type BlockData interface {
Hash() []byte
}
+func BlockDataToBytes(blk BlockData) ([]byte, error) {
+ buf := bytes.NewBuffer(nil)
+ err := blk.Marshal(buf)
+ return buf.Bytes(), err
+}
+
type Block interface {
BlockData
NextValidators() ValidatorList
