From 256892e6b7159cf47e0515c57e02f7d99aa04f95 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 9 May 2018 17:31:46 -0400 Subject: [PATCH] sharding: rename methods, tests pass. Former-commit-id: 55e22985980afb8538adcf13eae7242484c6466e [formerly 207348ebbfe33d343019fff3f47c5fbc7d7ea28a] Former-commit-id: c8543ee2327f9bb1863a90d9538ff302f3db09f2 --- sharding/collation.go | 7 ++++--- sharding/shard_test.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sharding/collation.go b/sharding/collation.go index 245558404..996a297fd 100644 --- a/sharding/collation.go +++ b/sharding/collation.go @@ -38,7 +38,7 @@ func NewCollationHeader(shardID *big.Int, chunkRoot *common.Hash, period *big.In ProposerAddress: proposerAddress, ProposerSignature: proposerSignature, } - return &CollationHeader{data: data} + return &CollationHeader{data} } // Hash takes the keccak256 of the collation header's contents. @@ -93,8 +93,9 @@ func (c *Collation) AddTransaction(tx *types.Transaction) { c.transactions = append(c.transactions, tx) } -// SetChunkRoot updates the collation header's chunk root. -func (c *Collation) SetChunkRoot() { +// CalculateChunkRoot updates the collation header's chunk root based on the body. +func (c *Collation) CalculateChunkRoot() { + // TODO: this needs to be based on blob serialization. chunkRoot := common.BytesToHash(c.body) c.header.data.ChunkRoot = &chunkRoot } diff --git a/sharding/shard_test.go b/sharding/shard_test.go index ee7cd6103..158139990 100644 --- a/sharding/shard_test.go +++ b/sharding/shard_test.go @@ -70,7 +70,7 @@ func TestShard_CollationByHash(t *testing.T) { } // We set the chunk root. - collation.SetChunkRoot() + collation.CalculateChunkRoot() shardDB := makeShardKV() shard := MakeShard(big.NewInt(1), shardDB)