good morning!!!!

Skip to content
Snippets Groups Projects
Commit 35f4bb96 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Limit hashes. Closes #249

parent b136b387
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,8 @@ type newBlockMsgData struct { ...@@ -67,6 +67,8 @@ type newBlockMsgData struct {
TD *big.Int TD *big.Int
} }
const maxHashes = 255
type getBlockHashesMsgData struct { type getBlockHashesMsgData struct {
Hash []byte Hash []byte
Amount uint64 Amount uint64
...@@ -139,6 +141,11 @@ func (self *ethProtocol) handle() error { ...@@ -139,6 +141,11 @@ func (self *ethProtocol) handle() error {
if err := msg.Decode(&request); err != nil { if err := msg.Decode(&request); err != nil {
return self.protoError(ErrDecode, "->msg %v: %v", msg, err) 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) hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount)
return p2p.EncodeMsg(self.rw, BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...) return p2p.EncodeMsg(self.rw, BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment