mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 00:27:38 +00:00
sharding/client: Adding Main serialize function(#92)
Former-commit-id: abb3b3d0213daf4b6e84c880cf202bf91d04d086 [formerly d3e6aad05cba1272ab84fe9c03140d3d3b092584] Former-commit-id: 1185e61d50a11f7fa15e986521f91856cb1df3d5
This commit is contained in:
parent
256078b48e
commit
1129d94303
@ -17,7 +17,7 @@ var (
|
||||
|
||||
type txblob []byte
|
||||
|
||||
type body interface {
|
||||
type blob interface {
|
||||
length() int64
|
||||
validateBody() error
|
||||
serializeBlob() []byte
|
||||
@ -45,12 +45,12 @@ func (cb txblob) validateBody() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func deserializebody(collationbody []byte) []body {
|
||||
func deserializebody(collationbody []byte) []blob {
|
||||
length := int64(len(collationbody))
|
||||
chunksNumber := chunkSize / length
|
||||
indicatorByte := make([]byte, 1)
|
||||
indicatorByte[0] = 0
|
||||
txblobs := []body{}
|
||||
txblobs := []blob{}
|
||||
var tempbody txblob
|
||||
|
||||
for i := int64(1); i <= chunksNumber; i++ {
|
||||
@ -72,7 +72,21 @@ func deserializebody(collationbody []byte) []body {
|
||||
|
||||
}
|
||||
|
||||
// Parse Collation body and modify it accordingly
|
||||
func serialize(rawtx []blob) []byte {
|
||||
length := int64(len(rawtx))
|
||||
serialisedData := []byte{}
|
||||
|
||||
for i := int64(1); i < length; i++ {
|
||||
data := rawtx[length].(txblob)
|
||||
refinedData := data.serializeBlob()
|
||||
serialisedData = append(serialisedData, refinedData...)
|
||||
txblob(serialisedData).validateBody()
|
||||
|
||||
}
|
||||
return serialisedData
|
||||
}
|
||||
|
||||
// Parse blob and modify it accordingly
|
||||
|
||||
func (cb txblob) serializeBlob() []byte {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user