Skip to content

Commit

Permalink
feat(act): download with publisher before grantee download
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferenc Sárai committed Jul 31, 2024
1 parent 4362255 commit 721d911
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/check/act/act.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,23 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int
c.logger.Info("ACT grantees listed after patch")
*/
// download act file
c.logger.Infof("ACT file download started from publisher: %s", fileAddress.String())
size0, hash0, err0 := upClient.DownloadActFile(ctx, fileAddress, &api.DownloadOptions{Act: &act, ActPublicKey: &publisher, ActHistoryAddress: &history})
if err0 != nil {
return fmt.Errorf("node %s: %w", upNodeName, err0)
}
if !bytes.Equal(file.Hash(), hash0) {
c.logger.Infof("Node %s. ACT file hash not equal. Uploaded size: %d Downloaded size: %d File: %s", upNodeName, file.Size(), size0, fileAddress.String())
return errors.New("ACT file retrieval - hash error")
}
// download act file
his := gFile.HistroryAddress()
c.logger.Infof("ACT file download started: %s", fileAddress.String())
c.logger.Infof("ACT file download started from client2: %s", fileAddress.String())
_, _, err1 := client2.DownloadActFile(ctx, fileAddress, &api.DownloadOptions{Act: &act, ActPublicKey: &publisher, ActHistoryAddress: &his})
if err1 != nil {
return fmt.Errorf("node %s: %w", nodeName1, err1)
return fmt.Errorf("node %s: %w", nodeName2, err1)
}

return errors.New("ACT file retrieval - hash error")
return
/*
if !bytes.Equal(file.Hash(), hash1) {
c.logger.Infof("Node %s. ACT file hash not equal. Uploaded size: %d Downloaded size: %d File: %s", nodeName1, file.Size(), size1, file.Address().String())
Expand Down

0 comments on commit 721d911

Please sign in to comment.