// Package recovery package recovery import ( "bytes" "fmt" "io/ioutil" "crypto/sha256" "math/rand" "testing" "time" "github.com/klauspost/reedsolomon" "github.com/ethereum/go-ethereum/common" "github.com/yottachain/YTFS" ytfsOpt "github.com/yottachain/YTFS/opt" ytfsCommon "github.com/yottachain/YTFS/common" ) func TestNewDataRecovery(t *testing.T) { _, err := NewDataCodec(nil, nil, DefaultRecoveryOption()) if err != nil { t.Fail() } } func randomFill(size uint32) []byte { buf := make([]byte, size, size) head := make([]byte, 16, 16) rand.Read(head) copy(buf, head) return buf } func createShards(dataShards, parityShards int) ([]common.Hash, [][]byte) { shards := make([][]byte, dataShards + parityShards) hashes := make([]common.Hash, dataShards + parityShards) dataBlkSize := ytfsOpt.DefaultOptions().DataBlockSize for i:=0;i