Initialize with same length as partition

Initialize the postParam.Partitions slice with the same length as i.Partitions before iterating over it in the loop.
This commit is contained in:
Phi 2023-03-27 10:04:15 +02:00
parent 41fce94db4
commit 0711fdc3dd

View File

@ -658,6 +658,10 @@ It will not send any messages to the chain.`,
for _, i := range res {
var postParam SubmitWindowedPoStParams
postParam.Deadline = i.Deadline
// Initialize the postParam.Partitions slice with the same length as i.Partitions
postParam.Partitions = make([]PoStPartition, len(i.Partitions))
for id, part := range i.Partitions {
postParam.Partitions[id].Index = part.Index
count, err := part.Skipped.Count()