aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-12-16 01:22:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-12-16 14:44:13 +0800
commite51eeb81044c5cfc9416da4edce6da25b90acdb3 (patch)
treed81e91ce90b50cbc764ffc59e349f6e8785baad4 /eth/handler.go
parentb9aedeab0b1cf56860f5ca53333a4f348395259c (diff)
downloaddexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.tar
dexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.tar.gz
dexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.tar.bz2
dexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.tar.lz
dexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.tar.xz
dexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.tar.zst
dexon-e51eeb81044c5cfc9416da4edce6da25b90acdb3.zip
eth: fix #2076, where end of hash query was interpreted number query
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/eth/handler.go b/eth/handler.go
index d8c5b4b64..d04f79105 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -372,6 +372,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
if err := msg.Decode(&query); err != nil {
return errResp(ErrDecode, "%v: %v", msg, err)
}
+ hashMode := query.Origin.Hash != (common.Hash{})
+
// Gather headers until the fetch or network limits is reached
var (
bytes common.StorageSize
@@ -381,7 +383,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
for !unknown && len(headers) < int(query.Amount) && bytes < softResponseLimit && len(headers) < downloader.MaxHeaderFetch {
// Retrieve the next header satisfying the query
var origin *types.Header
- if query.Origin.Hash != (common.Hash{}) {
+ if hashMode {
origin = pm.blockchain.GetHeader(query.Origin.Hash)
} else {
origin = pm.blockchain.GetHeaderByNumber(query.Origin.Number)