Skip to content

Commit 93b627b

Browse files
committed
sphinx: remove dead code and tiny refactor
This commit removes an unused var and changes bytes.Compare to the idiomatic bytes.Equal.
1 parent 1780f00 commit 93b627b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sphinx_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ func newTestRoute(numHops int) ([]*Router, *PaymentPath, *[]HopData, *OnionPacke
106106

107107
func TestBolt4Packet(t *testing.T) {
108108
var (
109-
route PaymentPath
110-
hopsData []HopData
109+
route PaymentPath
111110
)
112111
for i, pubKeyHex := range bolt4PubKeys {
113112
pubKeyBytes, err := hex.DecodeString(pubKeyHex)
@@ -125,7 +124,6 @@ func TestBolt4Packet(t *testing.T) {
125124
OutgoingCltv: uint32(i),
126125
}
127126
copy(hopData.NextAddress[:], bytes.Repeat([]byte{byte(i)}, 8))
128-
hopsData = append(hopsData, hopData)
129127

130128
hopPayload, err := NewLegacyHopPayload(&hopData)
131129
if err != nil {
@@ -157,7 +155,7 @@ func TestBolt4Packet(t *testing.T) {
157155
t.Fatalf("unable to decode onion packet: %v", err)
158156
}
159157

160-
if bytes.Compare(b.Bytes(), finalPacket) != 0 {
158+
if !bytes.Equal(b.Bytes(), finalPacket) {
161159
t.Fatalf("final packet does not match expected BOLT 4 packet, "+
162160
"want: %s, got %s", hex.EncodeToString(finalPacket),
163161
hex.EncodeToString(b.Bytes()))

0 commit comments

Comments
 (0)