diff --git a/pkg/storageincentives/proof.go b/pkg/storageincentives/proof.go index ebf4eede513..6eb6b9cd56b 100644 --- a/pkg/storageincentives/proof.go +++ b/pkg/storageincentives/proof.go @@ -18,7 +18,7 @@ import ( "github.com/ethersphere/bee/pkg/swarm" ) -var errorMessage = errors.New("reserve commitment hasher: failure in proof creation") +var errMessage = errors.New("reserve commitment hasher: failure in proof creation") // makeInclusionProofs creates transaction data for claim method. // In the document this logic, result data, is also called Proof of entitlement (POE). @@ -59,17 +59,17 @@ func makeInclusionProofs( rccontent.SetHeaderInt64(swarm.HashSize * storer.SampleSize * 2) rsc, err := sampleChunk(reserveSampleItems) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } rscData := rsc.Data() _, err = rccontent.Write(rscData[swarm.SpanSize:]) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr := bmt.Prover{Hasher: rccontent} _, err = pr.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } proof1p1 := pr.Proof(int(require1) * 2) proof2p1 := pr.Proof(int(require2) * 2) @@ -84,12 +84,12 @@ func makeInclusionProofs( chunk1ContentPayload := reserveSampleItems[require1].ChunkData[swarm.SpanSize:] _, err = chunk1Content.Write(chunk1ContentPayload) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr = bmt.Prover{Hasher: chunk1Content} _, err = pr.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } proof1p2 := pr.Proof(segmentIndex) // TR chunk proof @@ -97,11 +97,11 @@ func makeInclusionProofs( chunk1TrContent.SetHeader(reserveSampleItems[require1].ChunkData[:swarm.SpanSize]) _, err = chunk1TrContent.Write(chunk1ContentPayload) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } _, err = chunk1TrContent.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr = bmt.Prover{Hasher: chunk1TrContent} proof1p3 := pr.Proof(segmentIndex) @@ -116,12 +116,12 @@ func makeInclusionProofs( chunk2Content.SetHeader(reserveSampleItems[require2].ChunkData[:swarm.SpanSize]) _, err = chunk2Content.Write(chunk2ContentPayload) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr = bmt.Prover{Hasher: chunk2Content} _, err = pr.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } proof2p2 := pr.Proof(segmentIndex) // TR Chunk proof @@ -129,12 +129,12 @@ func makeInclusionProofs( chunk2TrContent.SetHeader(reserveSampleItems[require2].ChunkData[:swarm.SpanSize]) _, err = chunk2TrContent.Write(chunk2ContentPayload) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr = bmt.Prover{Hasher: chunk2TrContent} _, err = pr.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } proof2p3 := pr.Proof(segmentIndex) // cleanup @@ -148,12 +148,12 @@ func makeInclusionProofs( chunkLastContentPayload := reserveSampleItems[require3].ChunkData[swarm.SpanSize:] _, err = chunkLastContent.Write(chunkLastContentPayload) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr = bmt.Prover{Hasher: chunkLastContent} _, err = pr.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } proofLastp2 := pr.Proof(segmentIndex) // TR Chunk Proof @@ -161,12 +161,12 @@ func makeInclusionProofs( chunkLastTrContent.SetHeader(reserveSampleItems[require3].ChunkData[:swarm.SpanSize]) _, err = chunkLastTrContent.Write(chunkLastContentPayload) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } pr = bmt.Prover{Hasher: chunkLastTrContent} _, err = pr.Hash(nil) if err != nil { - return redistribution.ChunkInclusionProofs{}, errorMessage + return redistribution.ChunkInclusionProofs{}, errMessage } proofLastp3 := pr.Proof(segmentIndex) // cleanup