Unverified Commit 3f74c8e0 authored by Martin Holst Swende's avatar Martin Holst Swende Committed by GitHub

cmd/devp2p: better testcase failure output for ethtests (#22482)

parent 6387c520
...@@ -273,14 +273,15 @@ loop: ...@@ -273,14 +273,15 @@ loop:
for { for {
switch msg := c.Read().(type) { switch msg := c.Read().(type) {
case *Status: case *Status:
if msg.Head != chain.blocks[chain.Len()-1].Hash() { if have, want := msg.Head, chain.blocks[chain.Len()-1].Hash(); have != want {
t.Fatalf("wrong head block in status: %s", msg.Head.String()) t.Fatalf("wrong head block in status, want: %#x (block %d) have %#x",
want, chain.blocks[chain.Len()-1].NumberU64(), have)
} }
if msg.TD.Cmp(chain.TD(chain.Len())) != 0 { if have, want := msg.TD.Cmp(chain.TD(chain.Len())), 0; have != want {
t.Fatalf("wrong TD in status: %v", msg.TD) t.Fatalf("wrong TD in status: have %v want %v", have, want)
} }
if !reflect.DeepEqual(msg.ForkID, chain.ForkID()) { if have, want := msg.ForkID, chain.ForkID(); !reflect.DeepEqual(have, want) {
t.Fatalf("wrong fork ID in status: %v", msg.ForkID) t.Fatalf("wrong fork ID in status: have %v, want %v", have, want)
} }
message = msg message = msg
break loop break loop
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment