diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-02-27 10:41:01 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 0ac79d780ba63c574d648552f887c9411fdd76fe (patch) | |
tree | 0afb53c6bd8bd10f1beae428460c4481ee876dc1 /dex/peer.go | |
parent | d2a491c0b69bb0777b124e9ba278c05129bb327e (diff) | |
download | dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.tar dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.tar.gz dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.tar.bz2 dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.tar.lz dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.tar.xz dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.tar.zst dexon-0ac79d780ba63c574d648552f887c9411fdd76fe.zip |
core: sync to latest core (#214)
* vendor: sync to latest core
* fix for single chain
Diffstat (limited to 'dex/peer.go')
-rw-r--r-- | dex/peer.go | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/dex/peer.go b/dex/peer.go index a157709f0..8ade9f152 100644 --- a/dex/peer.go +++ b/dex/peer.go @@ -119,9 +119,8 @@ const ( ) type peerLabel struct { - set setType - chainID uint32 - round uint64 + set setType + round uint64 } func (p peerLabel) String() string { @@ -130,7 +129,7 @@ func (p peerLabel) String() string { case dkgset: t = fmt.Sprintf("DKGSet round: %d", p.round) case notaryset: - t = fmt.Sprintf("NotarySet round: %d chain: %d", p.round, p.chainID) + t = fmt.Sprintf("NotarySet round: %d", p.round) } return t } @@ -962,24 +961,22 @@ func (ps *peerSet) BuildConnection(round uint64) { } } - for chainID := uint32(0); chainID < ps.gov.GetNumChains(round); chainID++ { - notaryLabel := peerLabel{set: notaryset, chainID: chainID, round: round} - if _, ok := ps.label2Nodes[notaryLabel]; !ok { - notaryPKs, err := ps.gov.NotarySet(round, chainID) - if err != nil { - log.Error("get notary set fail", - "round", round, "chainID", chainID, "err", err) - continue - } + notaryLabel := peerLabel{set: notaryset, round: round} + if _, ok := ps.label2Nodes[notaryLabel]; !ok { + notaryPKs, err := ps.gov.NotarySet(round) + if err != nil { + log.Error("get notary set fail", + "round", round, "err", err) + return + } - nodes := ps.pksToNodes(notaryPKs) - ps.label2Nodes[notaryLabel] = nodes + nodes := ps.pksToNodes(notaryPKs) + ps.label2Nodes[notaryLabel] = nodes - if _, exists := nodes[ps.srvr.Self().ID().String()]; exists { - ps.buildDirectConn(notaryLabel) - } else { - ps.buildGroupConn(notaryLabel) - } + if _, exists := nodes[ps.srvr.Self().ID().String()]; exists { + ps.buildDirectConn(notaryLabel) + } else { + ps.buildGroupConn(notaryLabel) } } } |