@@ -11,7 +11,6 @@ import (
1111 "testing"
1212
1313 "github.com/btcsuite/btcd/btcec/v2"
14- "github.com/btcsuite/btcd/chaincfg"
1514 "github.com/davecgh/go-spew/spew"
1615 "github.com/stretchr/testify/require"
1716)
@@ -52,8 +51,7 @@ func newTestRoute(numHops int) ([]*Router, *PaymentPath, *[]HopData, *OnionPacke
5251 }
5352
5453 nodes [i ] = NewRouter (
55- & PrivKeyECDH {PrivKey : privKey }, & chaincfg .MainNetParams ,
56- NewMemoryReplayLog (),
54+ & PrivKeyECDH {PrivKey : privKey }, NewMemoryReplayLog (),
5755 )
5856 }
5957
@@ -219,12 +217,7 @@ func TestSphinxCorrectness(t *testing.T) {
219217 // The next hop should have been parsed as node[i+1].
220218 parsedNextHop := onionPacket .ForwardingInstructions .NextAddress [:]
221219 expected := bytes .Repeat ([]byte {byte (i )}, AddressSize )
222- if ! bytes .Equal (parsedNextHop , expected ) {
223- t .Fatalf ("Processing error, next hop parsed incorrectly." +
224- " next hop should be %v, was instead parsed as %v" ,
225- hex .EncodeToString (nodes [i + 1 ].nodeID [:]),
226- hex .EncodeToString (parsedNextHop ))
227- }
220+ require .Equal (t , expected , parsedNextHop )
228221
229222 fwdMsg = onionPacket .NextPacket
230223 }
@@ -303,14 +296,14 @@ func TestSphinxNodeRelpaySameBatch(t *testing.T) {
303296
304297 // Allow the node to process the initial packet, this should proceed
305298 // without any failures.
306- if err := tx .ProcessOnionPacket (0 , fwdMsg , nil , 1 , nil ); err != nil {
299+ if err := tx .ProcessOnionPacket (0 , fwdMsg , nil , 1 ); err != nil {
307300 t .Fatalf ("unable to process sphinx packet: %v" , err )
308301 }
309302
310303 // Now, force the node to process the packet a second time, this call
311304 // should not fail, even though the batch has internally recorded this
312305 // as a duplicate.
313- err = tx .ProcessOnionPacket (1 , fwdMsg , nil , 1 , nil )
306+ err = tx .ProcessOnionPacket (1 , fwdMsg , nil , 1 )
314307 if err != nil {
315308 t .Fatalf ("adding duplicate sphinx packet to batch should not " +
316309 "result in an error, instead got: %v" , err )
@@ -349,7 +342,7 @@ func TestSphinxNodeRelpayLaterBatch(t *testing.T) {
349342
350343 // Allow the node to process the initial packet, this should proceed
351344 // without any failures.
352- err = tx .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 , nil )
345+ err = tx .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 )
353346 if err != nil {
354347 t .Fatalf ("unable to process sphinx packet: %v" , err )
355348 }
@@ -363,7 +356,7 @@ func TestSphinxNodeRelpayLaterBatch(t *testing.T) {
363356
364357 // Now, force the node to process the packet a second time, this should
365358 // fail with a detected replay error.
366- err = tx2 .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 , nil )
359+ err = tx2 .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 )
367360 if err != nil {
368361 t .Fatalf ("sphinx packet replay should not have been rejected, " +
369362 "instead error is %v" , err )
@@ -395,7 +388,7 @@ func TestSphinxNodeReplayBatchIdempotency(t *testing.T) {
395388
396389 // Allow the node to process the initial packet, this should proceed
397390 // without any failures.
398- err = tx .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 , nil )
391+ err = tx .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 )
399392 if err != nil {
400393 t .Fatalf ("unable to process sphinx packet: %v" , err )
401394 }
@@ -409,7 +402,7 @@ func TestSphinxNodeReplayBatchIdempotency(t *testing.T) {
409402
410403 // Now, force the node to process the packet a second time, this should
411404 // not fail with a detected replay error.
412- err = tx2 .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 , nil )
405+ err = tx2 .ProcessOnionPacket (uint16 (0 ), fwdMsg , nil , 1 )
413406 if err != nil {
414407 t .Fatalf ("sphinx packet replay should not have been rejected, " +
415408 "instead error is %v" , err )
@@ -499,8 +492,7 @@ func newEOBRoute(numHops uint32,
499492 }
500493
501494 nodes [i ] = NewRouter (
502- & PrivKeyECDH {PrivKey : privKey }, & chaincfg .MainNetParams ,
503- NewMemoryReplayLog (),
495+ & PrivKeyECDH {PrivKey : privKey }, NewMemoryReplayLog (),
504496 )
505497 }
506498
0 commit comments