diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-02-27 10:41:01 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:57 +0800 |
commit | e83bcc1097d49b46b79131e546f1270b9192cc05 (patch) | |
tree | a1af659afd80e3744177637cc06b2f0662a0ced8 /dex/peer.go | |
parent | 22b38ce74c3da40b7b7f24ada0abdf8d5ba03c64 (diff) | |
download | go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.tar go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.tar.gz go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.tar.bz2 go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.tar.lz go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.tar.xz go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.tar.zst go-tangerine-e83bcc1097d49b46b79131e546f1270b9192cc05.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) } } } |