diff options
Diffstat (limited to 'simulation/tcp-network.go')
-rw-r--r-- | simulation/tcp-network.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/simulation/tcp-network.go b/simulation/tcp-network.go index c606daf..2da9e3a 100644 --- a/simulation/tcp-network.go +++ b/simulation/tcp-network.go @@ -254,6 +254,9 @@ func (n *TCPNetwork) Send(destID types.ValidatorID, msg interface{}) { case *types.Block: message.Type = "block" message.Payload = v + case *types.NotaryAck: + message.Type = "notaryAck" + message.Payload = v default: fmt.Println("error: invalid message type") return @@ -304,6 +307,17 @@ func (n *TCPNetwork) BroadcastBlock(block *types.Block) { } } +// BroadcastNotaryAck broadcast notaryAck into the network. +func (n *TCPNetwork) BroadcastNotaryAck(notaryAck *types.NotaryAck) { + notaryAck = notaryAck.Clone() + for endpoint := range n.endpoints { + if endpoint == notaryAck.ProposerID { + continue + } + n.Send(endpoint, notaryAck) + } +} + // DeliverBlocks sends blocks to peerServer. func (n *TCPNetwork) DeliverBlocks(blocks BlockList) { messageJSON, err := json.Marshal(blocks) |