Skip to content

Commit

Permalink
Removed unecessary if condition when sending empty structs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoAndreSa committed Mar 11, 2020
1 parent 3031cda commit 31c25d5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions protocols/collective_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ func NewCollectiveAggregationProtocol(n *onet.TreeNodeInstance) (onet.ProtocolIn
// Start is called at the root to begin the execution of the protocol.
func (p *CollectiveAggregationProtocol) Start() error {
log.Lvl1(p.ServerIdentity(), " started a Colective Aggregation Protocol")
if err := p.SendToChildren(&DataReferenceMessage{}); err != nil {
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
}
p.SendToChildren(&DataReferenceMessage{})
return nil
}

Expand Down Expand Up @@ -199,9 +197,7 @@ func (p *CollectiveAggregationProtocol) aggregationAnnouncementPhase() error {
select {
case dataReferenceMessage := <-p.DataReferenceChannel:
if !p.IsLeaf() {
if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
}
p.SendToChildren(&dataReferenceMessage.DataReferenceMessage)
}
case <-time.After(libunlynx.TIMEOUT):
return errors.New(p.ServerIdentity().String() + " didn't get the <dataReferenceMessage> on time.")
Expand Down

0 comments on commit 31c25d5

Please sign in to comment.