htlcswitch: change ForwardPackets to return error
As part of the preparation to the switch interceptor feature, this function is changed to return error instead of error channel that is closed automatically. Returning an error channel has become complex to maintain and implement when adding more asynchronous flows to the switch. The change doesn't affect the current behavior which logs the errors as before.
This commit is contained in:
1 parent
87880c0d56
commit
1a6701122c
6 files changed
+131
-135
No files matched your search
@@ -218,16 +218,13 @@ func newMailboxContext(t *testing.T, startTime time.Time,
|
||||
}
|
||||
|
||||
func (c *mailboxContext) forward(_ chan struct{},
|
||||
pkts ...*htlcPacket) chan error {
|
||||
pkts ...*htlcPacket) error {
|
||||
|
||||
for _, pkt := range pkts {
|
||||
c.forwards <- pkt
|
||||
}
|
||||
|
||||
errChan := make(chan error)
|
||||
close(errChan)
|
||||
|
||||
return errChan
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *mailboxContext) sendAdds(start, num int) []*htlcPacket {
|
||||
@@ -555,12 +552,8 @@ func TestMailOrchestrator(t *testing.T) {
|
||||
}, nil
|
||||
},
|
||||
forwardPackets: func(_ chan struct{},
|
||||
pkts ...*htlcPacket) chan error {
|
||||
// Close the channel immediately so the goroutine
|
||||
// logging errors can exit.
|
||||
errChan := make(chan error)
|
||||
close(errChan)
|
||||
return errChan
|
||||
pkts ...*htlcPacket) error {
|
||||
return nil
|
||||
},
|
||||
clock: clock.NewTestClock(time.Now()),
|
||||
expiry: testExpiry,
|
||||
|
||||
Reference in new issue
Block a user