mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
p2p: refactor to use slices.Delete
Signed-off-by: alex9long <alex9long@outlook.com>
This commit is contained in:
parent
43b2aac33c
commit
1b63f65ba8
2 changed files with 3 additions and 2 deletions
|
|
@ -182,7 +182,7 @@ func (t *pingRecorder) waitPing(timeout time.Duration) *enode.Node {
|
|||
}
|
||||
if len(t.pinged) > 0 {
|
||||
n := t.pinged[0]
|
||||
t.pinged = append(t.pinged[:0], t.pinged[1:]...)
|
||||
t.pinged = slices.Delete(t.pinged, 0, 1)
|
||||
return n
|
||||
}
|
||||
t.cond.Wait()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import (
|
|||
"net"
|
||||
"net/netip"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -348,7 +349,7 @@ func TestUDPv4_findnodeMultiReply(t *testing.T) {
|
|||
// check that the sent neighbors are all returned by findnode
|
||||
select {
|
||||
case result := <-resultc:
|
||||
want := append(list[:2], list[3:]...)
|
||||
want := slices.Delete(list, 2, 3)
|
||||
if !reflect.DeepEqual(result, want) {
|
||||
t.Errorf("neighbors mismatch:\n got: %v\n want: %v", result, want)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue