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