sharding: rename methods, tests pass.

Former-commit-id: 55e22985980afb8538adcf13eae7242484c6466e [formerly 207348ebbfe33d343019fff3f47c5fbc7d7ea28a]
Former-commit-id: c8543ee2327f9bb1863a90d9538ff302f3db09f2
This commit is contained in:
Raul Jordan 2018-05-09 17:31:46 -04:00
parent eb9c82b581
commit 256892e6b7
2 changed files with 5 additions and 4 deletions

View File

@ -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
}

View File

@ -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)