aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/tcp-network.go
diff options
context:
space:
mode:
Diffstat (limited to 'simulation/tcp-network.go')
-rw-r--r--simulation/tcp-network.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/simulation/tcp-network.go b/simulation/tcp-network.go
index 2da9e3a..bb63bd1 100644
--- a/simulation/tcp-network.go
+++ b/simulation/tcp-network.go
@@ -257,6 +257,9 @@ func (n *TCPNetwork) Send(destID types.ValidatorID, msg interface{}) {
case *types.NotaryAck:
message.Type = "notaryAck"
message.Payload = v
+ case *types.Vote:
+ message.Type = "vote"
+ message.Payload = v
default:
fmt.Println("error: invalid message type")
return
@@ -318,6 +321,17 @@ func (n *TCPNetwork) BroadcastNotaryAck(notaryAck *types.NotaryAck) {
}
}
+// BroadcastVote broadcast vote into the network.
+func (n *TCPNetwork) BroadcastVote(vote *types.Vote) {
+ vote = vote.Clone()
+ for endpoint := range n.endpoints {
+ if endpoint == vote.ProposerID {
+ continue
+ }
+ n.Send(endpoint, vote)
+ }
+}
+
// DeliverBlocks sends blocks to peerServer.
func (n *TCPNetwork) DeliverBlocks(blocks BlockList) {
messageJSON, err := json.Marshal(blocks)