MCPcopy Create free account
hub / github.com/DOSNetwork/core / TestSecretRecoveryDelete

Function TestSecretRecoveryDelete

share/poly_test.go:30–50  ·  view source on GitHub ↗
(test *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestSecretRecoveryDelete(test *testing.T) {
31 n := 10
32 t := n/2 + 1
33 poly := NewPriPoly(suite, t, nil, suite.RandomStream())
34 shares := poly.Shares(n)
35
36 // Corrupt a few shares
37 shares[2] = nil
38 shares[5] = nil
39 shares[7] = nil
40 shares[8] = nil
41
42 recovered, err := RecoverSecret(suite, shares, t, n)
43 if err != nil {
44 test.Fatal(err)
45 }
46
47 if !recovered.Equal(poly.Secret()) {
48 test.Fatal("recovered secret does not match initial value")
49 }
50}
51
52func TestSecretRecoveryDeleteFail(test *testing.T) {
53 n := 10

Callers

nothing calls this directly

Calls 7

SharesMethod · 0.95
SecretMethod · 0.95
NewPriPolyFunction · 0.85
RecoverSecretFunction · 0.70
FatalMethod · 0.65
RandomStreamMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected