Skip to content

Commit a140f83

Browse files
author
nisdas
committed
sharding: Cleaning up (ethereum#92)
1 parent c800d30 commit a140f83

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

sharding/collation.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ func (c *Collation) Body() []byte { return c.body }
9494

9595
// Transactions returns an array of tx's in the collation.
9696
var (
97-
collationsizelimit = int64(math.Pow(float64(2), float64(20)))
97+
collationSizelimit = int64(math.Pow(float64(2), float64(20)))
9898
chunkSize = int64(32)
99-
numberOfChunks = collationsizelimit / chunkSize
99+
numberOfChunks = collationSizelimit / chunkSize
100100
)
101101

102102
// Transactions returns an array of tx's in the collation.
@@ -159,30 +159,31 @@ func (c *Collation) Serialize() ([]byte, error) {
159159
return nil, fmt.Errorf("%v", err)
160160
}
161161

162-
serializedtx, err := utils.Serialize(blobs)
162+
serializedTx, err := utils.Serialize(blobs)
163163

164164
if err != nil {
165165
return nil, fmt.Errorf("%v", err)
166166
}
167167

168-
if int64(len(serializedtx)) > collationsizelimit {
169-
serializedtx = serializedtx[0:collationsizelimit]
168+
if int64(len(serializedTx)) > collationSizelimit {
169+
170+
return nil, fmt.Errorf("The serialized body exceeded the collation size limit", serializedTx)
170171

171172
}
172173

173-
return serializedtx, nil
174+
return serializedTx, nil
174175

175176
}
176177

177178
// Deserialize takes a byte array and converts its back to its original transactions.
178-
func (c *Collation) Deserialize(serialisedblob []byte) error {
179+
func (c *Collation) Deserialize(serialisedBlob []byte) error {
179180

180-
deserializedblobs, err := utils.Deserialize(serialisedblob)
181+
deserializedBlobs, err := utils.Deserialize(serialisedBlob)
181182
if err != nil {
182183
return fmt.Errorf("%v", err)
183184
}
184185

185-
err = c.ConvertBacktoTx(deserializedblobs)
186+
err = c.ConvertBacktoTx(deserializedBlobs)
186187

187188
if err != nil {
188189
return fmt.Errorf("%v", err)

0 commit comments

Comments
 (0)