mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 22:43:47 +00:00
Merge branch 'ethereum:master' into gethintegration
This commit is contained in:
commit
b013b8a629
3 changed files with 17 additions and 9 deletions
|
|
@ -111,7 +111,7 @@ func TestFuzzDeriveSha(t *testing.T) {
|
||||||
exp := types.DeriveSha(newDummy(i), trie.NewEmpty(triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil)))
|
exp := types.DeriveSha(newDummy(i), trie.NewEmpty(triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil)))
|
||||||
got := types.DeriveSha(newDummy(i), trie.NewStackTrie(nil))
|
got := types.DeriveSha(newDummy(i), trie.NewStackTrie(nil))
|
||||||
if !bytes.Equal(got[:], exp[:]) {
|
if !bytes.Equal(got[:], exp[:]) {
|
||||||
printList(newDummy(seed))
|
printList(t, newDummy(seed))
|
||||||
t.Fatalf("seed %d: got %x exp %x", seed, got, exp)
|
t.Fatalf("seed %d: got %x exp %x", seed, got, exp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -192,15 +192,21 @@ func (d *dummyDerivableList) EncodeIndex(i int, w *bytes.Buffer) {
|
||||||
io.CopyN(w, mrand.New(src), size)
|
io.CopyN(w, mrand.New(src), size)
|
||||||
}
|
}
|
||||||
|
|
||||||
func printList(l types.DerivableList) {
|
func printList(t *testing.T, l types.DerivableList) {
|
||||||
fmt.Printf("list length: %d\n", l.Len())
|
var buf bytes.Buffer
|
||||||
fmt.Printf("{\n")
|
_, _ = fmt.Fprintf(&buf, "list length: %d, ", l.Len())
|
||||||
|
buf.WriteString("list: [")
|
||||||
for i := 0; i < l.Len(); i++ {
|
for i := 0; i < l.Len(); i++ {
|
||||||
var buf bytes.Buffer
|
var itemBuf bytes.Buffer
|
||||||
l.EncodeIndex(i, &buf)
|
l.EncodeIndex(i, &itemBuf)
|
||||||
fmt.Printf("\"%#x\",\n", buf.Bytes())
|
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
|
type flatList []string
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ func (p *Peer) dispatchResponse(res *Response, metadata func() interface{}) erro
|
||||||
return <-res.Done // Response delivered, return any errors
|
return <-res.Done // Response delivered, return any errors
|
||||||
case <-res.Req.cancel:
|
case <-res.Req.cancel:
|
||||||
return nil // Request cancelled, silently discard response
|
return nil // Request cancelled, silently discard response
|
||||||
|
case <-p.term:
|
||||||
|
return errDisconnected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
if err := empty.handler.downloader.BeaconSync(ethconfig.SnapSync, full.chain.CurrentBlock(), nil); err != nil {
|
||||||
t.Fatal("sync failed:", err)
|
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() {
|
if empty.handler.snapSync.Load() {
|
||||||
t.Fatalf("snap sync not disabled after successful synchronisation")
|
t.Fatalf("snap sync not disabled after successful synchronisation")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue