Skip to content

Commit

Permalink
Merge branch 'ethereum:master' into gethintegration
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapeBaBa authored Jan 7, 2025
2 parents fbaafaf + 9298074 commit b013b8a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
22 changes: 14 additions & 8 deletions core/types/hashing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestFuzzDeriveSha(t *testing.T) {
exp := types.DeriveSha(newDummy(i), trie.NewEmpty(triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil)))
got := types.DeriveSha(newDummy(i), trie.NewStackTrie(nil))
if !bytes.Equal(got[:], exp[:]) {
printList(newDummy(seed))
printList(t, newDummy(seed))
t.Fatalf("seed %d: got %x exp %x", seed, got, exp)
}
}
Expand Down Expand Up @@ -192,15 +192,21 @@ func (d *dummyDerivableList) EncodeIndex(i int, w *bytes.Buffer) {
io.CopyN(w, mrand.New(src), size)
}

func printList(l types.DerivableList) {
fmt.Printf("list length: %d\n", l.Len())
fmt.Printf("{\n")
func printList(t *testing.T, l types.DerivableList) {
var buf bytes.Buffer
_, _ = fmt.Fprintf(&buf, "list length: %d, ", l.Len())
buf.WriteString("list: [")
for i := 0; i < l.Len(); i++ {
var buf bytes.Buffer
l.EncodeIndex(i, &buf)
fmt.Printf("\"%#x\",\n", buf.Bytes())
var itemBuf bytes.Buffer
l.EncodeIndex(i, &itemBuf)
if i == l.Len()-1 {
_, _ = fmt.Fprintf(&buf, "\"%#x\"", itemBuf.Bytes())
} else {
_, _ = fmt.Fprintf(&buf, "\"%#x\",", itemBuf.Bytes())
}
}
fmt.Printf("},\n")
buf.WriteString("]")
t.Log(buf.String())
}

type flatList []string
Expand Down
2 changes: 2 additions & 0 deletions eth/protocols/eth/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func (p *Peer) dispatchResponse(res *Response, metadata func() interface{}) erro
return <-res.Done // Response delivered, return any errors
case <-res.Req.cancel:
return nil // Request cancelled, silently discard response
case <-p.term:
return errDisconnected
}
}

Expand Down
2 changes: 1 addition & 1 deletion eth/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) {
if err := empty.handler.downloader.BeaconSync(ethconfig.SnapSync, full.chain.CurrentBlock(), nil); err != nil {
t.Fatal("sync failed:", err)
}
empty.handler.enableSyncedFeatures()
time.Sleep(time.Second * 5) // Downloader internally has to wait a timer (3s) to be expired before exiting

if empty.handler.snapSync.Load() {
t.Fatalf("snap sync not disabled after successful synchronisation")
Expand Down

0 comments on commit b013b8a

Please sign in to comment.