mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-27 07:27:31 +02:00
routing+routerrpc: test stream cancellation
Test stream cancellation of the TrackPayments rpc call. In order to achieve this, ControlTowerSubscriber is converted to an interface, to avoid trying to close a null channel when closing the subscription. By returning a mock implementation of the ControlTowerSubscriber in the test that problem is avoided.
This commit is contained in:
@@ -791,7 +791,7 @@ func (s *Server) TrackPayments(request *TrackPaymentsRequest,
|
||||
|
||||
// trackPaymentStream streams payment updates to the client.
|
||||
func (s *Server) trackPaymentStream(context context.Context,
|
||||
subscription *routing.ControlTowerSubscriber, noInflightUpdates bool,
|
||||
subscription routing.ControlTowerSubscriber, noInflightUpdates bool,
|
||||
send func(*lnrpc.Payment) error) error {
|
||||
|
||||
defer subscription.Close()
|
||||
@@ -799,7 +799,7 @@ func (s *Server) trackPaymentStream(context context.Context,
|
||||
// Stream updates back to the client.
|
||||
for {
|
||||
select {
|
||||
case item, ok := <-subscription.Updates:
|
||||
case item, ok := <-subscription.Updates():
|
||||
if !ok {
|
||||
// No more payment updates.
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user