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
7c029332
Commit
7c029332
authored
7 years ago
by
GagziW
Committed by
Péter Szilágyi
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
les: changed if-else blocks to conform with golint (#16658)
parent
f2447bd4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
19 deletions
+13
-19
distributor_test.go
les/distributor_test.go
+1
-2
protocol.go
les/protocol.go
+1
-2
randselect.go
les/randselect.go
+10
-13
serverpool.go
les/serverpool.go
+1
-2
No files found.
les/distributor_test.go
View file @
7c029332
...
...
@@ -97,9 +97,8 @@ func (p *testDistPeer) waitBefore(cost uint64) (time.Duration, float64) {
p
.
lock
.
RUnlock
()
if
sumCost
<
testDistBufLimit
{
return
0
,
float64
(
testDistBufLimit
-
sumCost
)
/
float64
(
testDistBufLimit
)
}
else
{
return
time
.
Duration
(
sumCost
-
testDistBufLimit
),
0
}
return
time
.
Duration
(
sumCost
-
testDistBufLimit
),
0
}
func
(
p
*
testDistPeer
)
canQueue
()
bool
{
...
...
This diff is collapsed.
Click to expand it.
les/protocol.go
View file @
7c029332
...
...
@@ -160,9 +160,8 @@ func (a *announceData) checkSignature(pubKey *ecdsa.PublicKey) error {
pbytes
:=
elliptic
.
Marshal
(
pubKey
.
Curve
,
pubKey
.
X
,
pubKey
.
Y
)
if
bytes
.
Equal
(
pbytes
,
recPubkey
)
{
return
nil
}
else
{
return
errors
.
New
(
"Wrong signature"
)
}
return
errors
.
New
(
"Wrong signature"
)
}
type
blockInfo
struct
{
...
...
This diff is collapsed.
Click to expand it.
les/randselect.go
View file @
7c029332
...
...
@@ -118,17 +118,16 @@ func (n *wrsNode) insert(item wrsItem, weight int64) int {
if
n
.
level
==
0
{
n
.
items
[
branch
]
=
item
return
branch
}
var
subNode
*
wrsNode
if
n
.
items
[
branch
]
==
nil
{
subNode
=
&
wrsNode
{
maxItems
:
n
.
maxItems
/
wrsBranches
,
level
:
n
.
level
-
1
}
n
.
items
[
branch
]
=
subNode
}
else
{
var
subNode
*
wrsNode
if
n
.
items
[
branch
]
==
nil
{
subNode
=
&
wrsNode
{
maxItems
:
n
.
maxItems
/
wrsBranches
,
level
:
n
.
level
-
1
}
n
.
items
[
branch
]
=
subNode
}
else
{
subNode
=
n
.
items
[
branch
]
.
(
*
wrsNode
)
}
subIdx
:=
subNode
.
insert
(
item
,
weight
)
return
subNode
.
maxItems
*
branch
+
subIdx
subNode
=
n
.
items
[
branch
]
.
(
*
wrsNode
)
}
subIdx
:=
subNode
.
insert
(
item
,
weight
)
return
subNode
.
maxItems
*
branch
+
subIdx
}
// setWeight updates the weight of a certain item (which should exist) and returns
...
...
@@ -162,12 +161,10 @@ func (n *wrsNode) choose(val int64) (wrsItem, int64) {
if
val
<
w
{
if
n
.
level
==
0
{
return
n
.
items
[
i
]
.
(
wrsItem
),
n
.
weights
[
i
]
}
else
{
return
n
.
items
[
i
]
.
(
*
wrsNode
)
.
choose
(
val
)
}
}
else
{
val
-=
w
return
n
.
items
[
i
]
.
(
*
wrsNode
)
.
choose
(
val
)
}
val
-=
w
}
panic
(
nil
)
}
This diff is collapsed.
Click to expand it.
les/serverpool.go
View file @
7c029332
...
...
@@ -601,9 +601,8 @@ func (e *discoveredEntry) Weight() int64 {
t
:=
time
.
Duration
(
mclock
.
Now
()
-
e
.
lastDiscovered
)
if
t
<=
discoverExpireStart
{
return
1000000000
}
else
{
return
int64
(
1000000000
*
math
.
Exp
(
-
float64
(
t
-
discoverExpireStart
)
/
float64
(
discoverExpireConst
)))
}
return
int64
(
1000000000
*
math
.
Exp
(
-
float64
(
t
-
discoverExpireStart
)
/
float64
(
discoverExpireConst
)))
}
// knownEntry implements wrsItem
...
...
This diff is collapsed.
Click to expand it.
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