aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-09 23:44:09 +0800
committerobscuren <geffobscura@gmail.com>2015-01-09 23:44:09 +0800
commit35f4bb96f313f4f04e70d1cf135be3a4759a8179 (patch)
tree6a7db9ef1db9864f4a81e98b92e088ae6d62b119 /eth/protocol.go
parentb136b387a779fe668afd2b127ec3e92b3bf21686 (diff)
downloadgo-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.tar
go-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.tar.gz
go-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.tar.bz2
go-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.tar.lz
go-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.tar.xz
go-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.tar.zst
go-tangerine-35f4bb96f313f4f04e70d1cf135be3a4759a8179.zip
Limit hashes. Closes #249
Diffstat (limited to 'eth/protocol.go')
-rw-r--r--eth/protocol.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index c9a5dea8d..24a0f0a8e 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -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)...)