htlcswitch/test: isolate test packets

Decouple the tests somewhat and fix a bug along the way where the test
passed because of a left-over package from a prior test.
This commit is contained in:
Joost Jager committed 2022-04-12 08:27:04 +02:00
1 parent 2fd900b172
commit bae0b6bdf9
2 files changed
+54 -34

No files matched your search

+5 -3
View File
@@ -690,9 +690,11 @@ func (f *mockChannelLink) completeCircuit(pkt *htlcPacket) error {
f.htlcID++
case *lnwire.UpdateFulfillHTLC, *lnwire.UpdateFailHTLC:
err := f.htlcSwitch.teardownCircuit(pkt)
if err != nil {
return err
if pkt.circuit != nil {
err := f.htlcSwitch.teardownCircuit(pkt)
if err != nil {
return err
}
}
}