From f72b962792c54b5f729c81daf919b4def40d7e66 Mon Sep 17 00:00:00 2001 From: zees-dev Date: Sat, 15 Jun 2024 13:55:38 +1200 Subject: [PATCH] head node propagation can now also include signatures --- node/aggregate/aggregate.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/node/aggregate/aggregate.go b/node/aggregate/aggregate.go index 20cce244..0de8925c 100644 --- a/node/aggregate/aggregate.go +++ b/node/aggregate/aggregate.go @@ -17,11 +17,14 @@ type Result struct { Peers []peer.ID `json:"peers,omitempty"` // How frequent was this result, in percentages. Frequency float64 `json:"frequency,omitempty"` + // Signature of this result + Signature []byte `json:"signature,omitempty"` } type resultStats struct { - seen uint - peers []peer.ID + seen uint + peers []peer.ID + signature []byte } func Aggregate(results execute.ResultMap) Results { @@ -40,13 +43,15 @@ func Aggregate(results execute.ResultMap) Results { stat, ok := stats[output] if !ok { stats[output] = resultStats{ - seen: 0, - peers: make([]peer.ID, 0), + seen: 0, + peers: make([]peer.ID, 0), + signature: res.Signature, } } stat.seen++ stat.peers = append(stat.peers, executingPeer) + stat.signature = res.Signature stats[output] = stat } @@ -59,6 +64,7 @@ func Aggregate(results execute.ResultMap) Results { Result: res, Peers: stat.peers, Frequency: 100 * float64(stat.seen) / float64(total), + Signature: stat.signature, } aggregated = append(aggregated, aggr)