|
|
@@ -68,3 +68,19 @@ func TestBlockEncoding(t *testing.T) {
|
|
|
t.Errorf("encoded block mismatch:\ngot: %x\nwant: %x", ourBlockEnc, blockEnc)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func TestUncleHash(t *testing.T) {
|
|
|
+ uncles := make([]*Header, 0)
|
|
|
+ h := CalcUncleHash(uncles)
|
|
|
+ exp := common.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")
|
|
|
+ if h != exp {
|
|
|
+ t.Fatalf("empty uncle hash is wrong, got %x != %x", h, exp)
|
|
|
+ }
|
|
|
+}
|
|
|
+func BenchmarkUncleHash(b *testing.B) {
|
|
|
+ uncles := make([]*Header, 0)
|
|
|
+ b.ResetTimer()
|
|
|
+ for i := 0; i < b.N; i++ {
|
|
|
+ CalcUncleHash(uncles)
|
|
|
+ }
|
|
|
+}
|