@@ -35,9 +35,7 @@ func TestOnionFailure(t *testing.T) {
35
35
}
36
36
37
37
// Emulate creation of the obfuscator on node where error have occurred.
38
- obfuscator := & OnionErrorEncrypter {
39
- sharedSecret : sharedSecrets [len (errorPath )- 1 ],
40
- }
38
+ obfuscator := NewOnionErrorEncrypter (sharedSecrets [len (errorPath )- 1 ])
41
39
42
40
// Emulate the situation when last hop creates the onion failure
43
41
// message and send it back.
@@ -47,9 +45,7 @@ func TestOnionFailure(t *testing.T) {
47
45
for i := len (errorPath ) - 2 ; i >= 0 ; i -- {
48
46
// Emulate creation of the obfuscator on forwarding node which
49
47
// propagates the onion failure.
50
- obfuscator = & OnionErrorEncrypter {
51
- sharedSecret : sharedSecrets [i ],
52
- }
48
+ obfuscator = NewOnionErrorEncrypter (sharedSecrets [i ])
53
49
obfuscatedData = obfuscator .EncryptError (false , obfuscatedData )
54
50
}
55
51
@@ -208,16 +204,16 @@ func TestOnionFailureSpecVector(t *testing.T) {
208
204
t .Fatalf ("unable to decode spec shared secret: %v" ,
209
205
err )
210
206
}
211
- obfuscator := & OnionErrorEncrypter {
212
- sharedSecret : sharedSecrets [len (sharedSecrets )- 1 - i ],
213
- }
207
+ obfuscator := NewOnionErrorEncrypter (
208
+ sharedSecrets [len (sharedSecrets )- 1 - i ],
209
+ )
214
210
215
211
var b bytes.Buffer
216
212
if err := obfuscator .Encode (& b ); err != nil {
217
213
t .Fatalf ("unable to encode obfuscator: %v" , err )
218
214
}
219
215
220
- obfuscator2 := & OnionErrorEncrypter {}
216
+ obfuscator2 := NewOnionErrorEncrypter ( Hash256 {})
221
217
obfuscatorReader := bytes .NewReader (b .Bytes ())
222
218
if err := obfuscator2 .Decode (obfuscatorReader ); err != nil {
223
219
t .Fatalf ("unable to decode obfuscator: %v" , err )
0 commit comments