aboutsummaryrefslogtreecommitdiffstats
path: root/dex/network.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-27 09:17:28 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-28 14:15:39 +0800
commit50a0622f1797096a0836246177f41f77cb4b0e8b (patch)
tree3a7ce1407fd555365733bb76c456b19aef37f126 /dex/network.go
parentbc18f6b29086e1a98590d41b2c1e362505af49aa (diff)
downloaddexon-50a0622f1797096a0836246177f41f77cb4b0e8b.tar
dexon-50a0622f1797096a0836246177f41f77cb4b0e8b.tar.gz
dexon-50a0622f1797096a0836246177f41f77cb4b0e8b.tar.bz2
dexon-50a0622f1797096a0836246177f41f77cb4b0e8b.tar.lz
dexon-50a0622f1797096a0836246177f41f77cb4b0e8b.tar.xz
dexon-50a0622f1797096a0836246177f41f77cb4b0e8b.tar.zst
dexon-50a0622f1797096a0836246177f41f77cb4b0e8b.zip
dex: add pull randomness (#105)
* vendor: sync to latest core * dex: Add PullRandomness
Diffstat (limited to 'dex/network.go')
-rw-r--r--dex/network.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/dex/network.go b/dex/network.go
index 38ee614ad..c5f81782d 100644
--- a/dex/network.go
+++ b/dex/network.go
@@ -34,6 +34,9 @@ func NewDexconNetwork(pm *ProtocolManager) *DexconNetwork {
// PullBlocks tries to pull blocks from the DEXON network.
func (n *DexconNetwork) PullBlocks(hashes coreCommon.Hashes) {
+ if len(hashes) == 0 {
+ return
+ }
n.pm.BroadcastPullBlocks(hashes)
}
@@ -42,6 +45,14 @@ func (n *DexconNetwork) PullVotes(pos types.Position) {
n.pm.BroadcastPullVotes(pos)
}
+// PullRandomness tries to pull randomness result from the DEXON network.
+func (n *DexconNetwork) PullRandomness(hashes coreCommon.Hashes) {
+ if len(hashes) == 0 {
+ return
+ }
+ n.pm.BroadcastPullRandomness(hashes)
+}
+
// BroadcastVote broadcasts vote to all nodes in DEXON network.
func (n *DexconNetwork) BroadcastVote(vote *types.Vote) {
n.pm.BroadcastVote(vote)