Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
66609293
Unverified
Commit
66609293
authored
Sep 28, 2020
by
mr_franklin
Committed by
GitHub
Sep 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/enode: remove unused code (#21612)
parent
b007df89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
21 deletions
+0
-21
node.go
p2p/enode/node.go
+0
-21
No files found.
p2p/enode/node.go
View file @
66609293
...
@@ -23,7 +23,6 @@ import (
...
@@ -23,7 +23,6 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"math/bits"
"math/bits"
"math/rand"
"net"
"net"
"strings"
"strings"
...
@@ -278,23 +277,3 @@ func LogDist(a, b ID) int {
...
@@ -278,23 +277,3 @@ func LogDist(a, b ID) int {
}
}
return
len
(
a
)
*
8
-
lz
return
len
(
a
)
*
8
-
lz
}
}
// RandomID returns a random ID b such that logdist(a, b) == n.
func
RandomID
(
a
ID
,
n
int
)
(
b
ID
)
{
if
n
==
0
{
return
a
}
// flip bit at position n, fill the rest with random bits
b
=
a
pos
:=
len
(
a
)
-
n
/
8
-
1
bit
:=
byte
(
0x01
)
<<
(
byte
(
n
%
8
)
-
1
)
if
bit
==
0
{
pos
++
bit
=
0x80
}
b
[
pos
]
=
a
[
pos
]
&^
bit
|
^
a
[
pos
]
&
bit
// TODO: randomize end bits
for
i
:=
pos
+
1
;
i
<
len
(
a
);
i
++
{
b
[
i
]
=
byte
(
rand
.
Intn
(
255
))
}
return
b
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment