aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJhih-Ming Huang <jm@byzantine-lab.io>2019-08-28 14:05:06 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-09-17 16:57:31 +0800
commit3de6c17ecea5ee7efc6ab4b442b0aa9b8c590eea (patch)
tree59e5791b6777ee3022aac7ac94a619c3f246ee64
parent74894e1da7ff3c6999e7ae4a0b398340dbf34bef (diff)
downloadgo-tangerine-3de6c17ecea5ee7efc6ab4b442b0aa9b8c590eea.tar.gz
go-tangerine-3de6c17ecea5ee7efc6ab4b442b0aa9b8c590eea.tar.zst
go-tangerine-3de6c17ecea5ee7efc6ab4b442b0aa9b8c590eea.zip
dex: handler: check IsConsorium with dexonConfig instead of gov state
-rw-r--r--dex/handler.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/dex/handler.go b/dex/handler.go
index 94d7d79e5..19ca52573 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -388,15 +388,15 @@ func (pm *ProtocolManager) newPeer(pv int, p *p2p.Peer, rw p2p.MsgReadWriter) *p
}
func (pm *ProtocolManager) inWhitelist(p *peer) bool {
+ if pm.chainconfig.Dexcon == nil || !pm.chainconfig.Dexcon.IsConsortium {
+ return true
+ }
state, err := pm.blockchain.State()
if err != nil {
p.Log().Debug("get state fail in checking whitelist", "err", err)
return false
}
govState := vm.GovernanceState{StateDB: state}
- if !govState.IsConsortium() {
- return true
- }
address := crypto.PubkeyToAddress(*p.Node().Pubkey())
return govState.WhitelistOffsetByAddress(address).Cmp(big.NewInt(0)) >= 0
}