diff options
author | Sonic <sonic@cobinhood.com> | 2018-10-12 15:02:33 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:23:39 +0800 |
commit | 046ea228bf3892a01b8de060390e766483a69249 (patch) | |
tree | fd03cfde6234c4be590a1fcd6e6c69afea03a705 /dex/network.go | |
parent | 8250fd5357e8a9c4b634cf289489ce2c4ec3470c (diff) | |
download | go-tangerine-046ea228bf3892a01b8de060390e766483a69249.tar.gz go-tangerine-046ea228bf3892a01b8de060390e766483a69249.tar.zst go-tangerine-046ea228bf3892a01b8de060390e766483a69249.zip |
dex: network: implement the network interface
Diffstat (limited to 'dex/network.go')
-rw-r--r-- | dex/network.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/dex/network.go b/dex/network.go index 24ef2cc63..e99b4f5b1 100644 --- a/dex/network.go +++ b/dex/network.go @@ -6,49 +6,53 @@ import ( ) type DexconNetwork struct { - receiveChan chan interface{} + pm *ProtocolManager } -func NewDexconNetwork() *DexconNetwork { - return &DexconNetwork{ - receiveChan: make(chan interface{}), - } +func NewDexconNetwork(pm *ProtocolManager) *DexconNetwork { + return &DexconNetwork{pm: pm} } // BroadcastVote broadcasts vote to all nodes in DEXON network. func (n *DexconNetwork) BroadcastVote(vote *types.Vote) { + n.pm.BroadcastVote(vote) } // BroadcastBlock broadcasts block to all nodes in DEXON network. func (n *DexconNetwork) BroadcastBlock(block *types.Block) { + n.pm.BroadcastLatticeBlock(block) } // SendDKGPrivateShare sends PrivateShare to a DKG participant. func (n *DexconNetwork) SendDKGPrivateShare( pub crypto.PublicKey, prvShare *types.DKGPrivateShare) { + n.pm.SendDKGPrivateShare(pub, prvShare) } // BroadcastDKGPrivateShare broadcasts PrivateShare to all DKG participants. func (n *DexconNetwork) BroadcastDKGPrivateShare( prvShare *types.DKGPrivateShare) { + n.pm.BroadcastDKGPrivateShare(prvShare) } // BroadcastDKGPartialSignature broadcasts partialSignature to all // DKG participants. func (n *DexconNetwork) BroadcastDKGPartialSignature( psig *types.DKGPartialSignature) { + n.pm.BroadcastDKGPartialSignature(psig) } // BroadcastAgreementResult broadcasts rand request to DKG set. func (n *DexconNetwork) BroadcastAgreementResult(randRequest *types.AgreementResult) { - + n.pm.BroadcastAgreementResult(randRequest) } // BroadcastRandomnessResult broadcasts rand request to Notary set. func (n *DexconNetwork) BroadcastRandomnessResult(randResult *types.BlockRandomnessResult) { + n.pm.BroadcastRandomnessResult(randResult) } // ReceiveChan returns a channel to receive messages from DEXON network. func (n *DexconNetwork) ReceiveChan() <-chan interface{} { - return n.receiveChan + return n.pm.ReceiveChan() } |