@@ -2,6 +2,7 @@ package cascade
22
33import (
44 "context"
5+ "encoding/hex"
56 "fmt"
67 "sort"
78 "strings"
@@ -13,14 +14,16 @@ import (
1314)
1415
1516type RecoveryReseedRequest struct {
16- ActionID string
17+ ActionID string
18+ PersistArtifacts * bool
1719}
1820
1921type RecoveryReseedResult struct {
2022 ActionID string
2123 DownloadEvents int
2224 DownloadLastEvent string
2325 DecodeCleanupError string
26+ ReconstructedHashHex string
2427 RQIC uint64
2528 RQMax uint64
2629 DataHashVerified bool
@@ -114,8 +117,13 @@ func (task *CascadeRegistrationTask) RecoveryReseed(ctx context.Context, req *Re
114117 if err := cascadekit .VerifyB64DataHash (fileHash , meta .DataHash ); err != nil {
115118 return result , task .wrapErr (ctx , "decoded file hash does not match action metadata" , err , fields )
116119 }
120+ result .ReconstructedHashHex = hex .EncodeToString (fileHash )
117121 result .DataHashVerified = true
118122
123+ if ! shouldPersistArtifacts (req ) {
124+ return result , nil
125+ }
126+
119127 encodeResult , err := task .encodeInput (ctx , actionID , decodeFilePath , fields )
120128 if err != nil {
121129 return result , err
@@ -143,6 +151,13 @@ func (task *CascadeRegistrationTask) RecoveryReseed(ctx context.Context, req *Re
143151 return result , nil
144152}
145153
154+ func shouldPersistArtifacts (req * RecoveryReseedRequest ) bool {
155+ if req == nil || req .PersistArtifacts == nil {
156+ return true
157+ }
158+ return * req .PersistArtifacts
159+ }
160+
146161func symbolIDsFromLayout (layout codec.Layout ) []string {
147162 seen := make (map [string ]struct {}, 1024 )
148163 for _ , block := range layout .Blocks {
0 commit comments