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
35f4bb96
Commit
35f4bb96
authored
Jan 09, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit hashes. Closes #249
parent
b136b387
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
protocol.go
eth/protocol.go
+7
-0
No files found.
eth/protocol.go
View file @
35f4bb96
...
...
@@ -67,6 +67,8 @@ type newBlockMsgData struct {
TD
*
big
.
Int
}
const
maxHashes
=
255
type
getBlockHashesMsgData
struct
{
Hash
[]
byte
Amount
uint64
...
...
@@ -139,6 +141,11 @@ func (self *ethProtocol) handle() error {
if
err
:=
msg
.
Decode
(
&
request
);
err
!=
nil
{
return
self
.
protoError
(
ErrDecode
,
"->msg %v: %v"
,
msg
,
err
)
}
//request.Amount = uint64(math.Min(float64(maxHashes), float64(request.Amount)))
if
request
.
Amount
>
maxHashes
{
request
.
Amount
=
maxHashes
}
hashes
:=
self
.
chainManager
.
GetBlockHashesFromHash
(
request
.
Hash
,
request
.
Amount
)
return
p2p
.
EncodeMsg
(
self
.
rw
,
BlockHashesMsg
,
ethutil
.
ByteSliceToInterface
(
hashes
)
...
)
...
...
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