Skip to content

Commit

Permalink
Remove the isLeaf condition for the SendToChildren call
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoAndreSa committed Mar 11, 2020
1 parent 8861342 commit f3812c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions protocols/collective_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ 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")
p.SendToChildren(&DataReferenceMessage{})
if err := p.SendToChildren(&DataReferenceMessage{}); err != nil {
return fmt.Errorf("error sending <DataReferenceMessage>: %v", err)
}
return nil
}

Expand Down Expand Up @@ -196,8 +198,8 @@ func (p *CollectiveAggregationProtocol) Dispatch() error {
func (p *CollectiveAggregationProtocol) aggregationAnnouncementPhase() error {
select {
case dataReferenceMessage := <-p.DataReferenceChannel:
if !p.IsLeaf() {
p.SendToChildren(&dataReferenceMessage.DataReferenceMessage)
if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return fmt.Errorf("error sending <DataReferenceMessage>: %v", err)
}
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <dataReferenceMessage> on time")
Expand Down
6 changes: 2 additions & 4 deletions protocols/key_switching_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,8 @@ func (p *KeySwitchingProtocol) announcementKSPhase() (kyber.Point, []kyber.Point
return nil, nil, fmt.Errorf(p.ServerIdentity().String() + " didn't get the <dataReferenceMessage> on time")
}

if !p.IsLeaf() {
if err := p.SendToChildren(&dataReferenceMessage.DownMessageBytes); err != nil {
return nil, nil, fmt.Errorf("Node "+p.ServerIdentity().String()+" failed to broadcast DownMessageBytes: %v", err)
}
if err := p.SendToChildren(&dataReferenceMessage.DownMessageBytes); err != nil {
return nil, nil, fmt.Errorf("Node "+p.ServerIdentity().String()+" failed to broadcast DownMessageBytes: %v", err)
}
message, err := libunlynx.FromBytesToAbstractPoints(dataReferenceMessage.Data)
if err != nil {
Expand Down

0 comments on commit f3812c3

Please sign in to comment.