From fb3e26159b092556c82a9aa5c67a795b9cd4cab6 Mon Sep 17 00:00:00 2001 From: Eli Date: Tue, 12 Jun 2018 10:11:22 -0700 Subject: [PATCH] sharding: treated rlp error similar to transactions Former-commit-id: fe1aa2a4427d8cc68a8f3b91d1c4f08b2f41b4b6 [formerly e1202f47345cb9aa3b37663573e2a07703b29c47] Former-commit-id: 324cc86345ff6666c94914b30cadbf136b4a3cee --- sharding/collation.go | 5 +---- sharding/collation_test.go | 6 ------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/sharding/collation.go b/sharding/collation.go index 9221b388e..108c9ca0f 100644 --- a/sharding/collation.go +++ b/sharding/collation.go @@ -220,9 +220,6 @@ func (ch Chunks) Len() int { return len(ch) } // GetRlp returns the RLP encoding of one chunk from the list. func (ch Chunks) GetRlp(i int) []byte { - bytes, err := rlp.EncodeToBytes(ch[i]) - if err != nil { - panic(err) - } + bytes, _ := rlp.EncodeToBytes(ch[i]) return bytes } diff --git a/sharding/collation_test.go b/sharding/collation_test.go index cfb517abd..5d74907c0 100644 --- a/sharding/collation_test.go +++ b/sharding/collation_test.go @@ -1,8 +1,6 @@ package sharding import ( - "fmt" - "bytes" "crypto/rand" "math/big" @@ -141,13 +139,9 @@ func Test_CalculatePOC(t *testing.T) { makeTxWithGasLimit(100), } c := NewCollation(header, body, transactions) - c.CalculateChunkRoot() salt := []byte{1, 0x9f} - fmt.Printf("%x\n", c.header.data.ChunkRoot) poc := c.CalculatePOC(salt) - fmt.Printf("%x\n", c.header.data.ChunkRoot) - fmt.Printf("%x\n", poc) if poc == *c.header.data.ChunkRoot { t.Errorf("Proof of Custody with Salt: %x does not differ from ChunkRoot without salt.", salt)