aboutsummaryrefslogtreecommitdiffstats
path: root/dex/handler.go
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2018-11-22 15:09:49 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commitfc2df4ef1c189accd7a4c4ed90d8e3562b5d9e60 (patch)
treeab71c9a0511121f35cce5a666ea7574bf0ab31b0 /dex/handler.go
parent9d8b455d62d851d265a8383a5d34e9c594ff89c9 (diff)
downloadgo-tangerine-fc2df4ef1c189accd7a4c4ed90d8e3562b5d9e60.tar.gz
go-tangerine-fc2df4ef1c189accd7a4c4ed90d8e3562b5d9e60.tar.zst
go-tangerine-fc2df4ef1c189accd7a4c4ed90d8e3562b5d9e60.zip
core, dex, downloader: refactor governance
Diffstat (limited to 'dex/handler.go')
-rw-r--r--dex/handler.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/dex/handler.go b/dex/handler.go
index a86a68329..b4499ae5a 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -34,7 +34,6 @@
package dex
import (
- "context"
"encoding/json"
"errors"
"fmt"
@@ -495,7 +494,6 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
}
}
- ctx := context.Background()
if query.WithGov && len(headers) > 0 {
last := headers[len(headers)-1]
currentBlock := pm.blockchain.CurrentBlock()
@@ -513,11 +511,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
if r == 0 {
continue
}
- h, err := pm.gov.GetRoundHeight(ctx, r)
- if err != nil {
- log.Warn("Get round height fail", "err", err)
- return p.SendBlockHeaders([]*types.HeaderWithGovState{})
- }
+ h := pm.gov.GetRoundHeight(r)
log.Trace("#Snapshot height", "height", h)
if h == 0 {
h = height
@@ -1181,7 +1175,9 @@ func (pm *ProtocolManager) peerSetLoop() {
}
if newRound == round+1 {
pm.peers.BuildConnection(newRound)
- pm.peers.ForgetConnection(round - 1)
+ if round >= 1 {
+ pm.peers.ForgetConnection(round - 1)
+ }
} else {
// just forget all network connection and rebuild.
pm.peers.ForgetConnection(round)