File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2128,6 +2128,34 @@ func macFromBytes(macBytes []byte) (grpc.DialOption, error) {
21282128 return grpc .WithPerRPCCredentials (cred ), nil
21292129}
21302130
2131+ func assertMinNumHtlcs (t * testing.T , node * HarnessNode , expected int ) {
2132+ t .Helper ()
2133+
2134+ ctxb := context .Background ()
2135+
2136+ err := wait .NoError (func () error {
2137+ listChansRequest := & lnrpc.ListChannelsRequest {}
2138+ listChansResp , err := node .ListChannels (ctxb , listChansRequest )
2139+ if err != nil {
2140+ return err
2141+ }
2142+
2143+ var numHtlcs int
2144+ for _ , channel := range listChansResp .Channels {
2145+ numHtlcs += len (channel .PendingHtlcs )
2146+ }
2147+
2148+ if numHtlcs < expected {
2149+ return fmt .Errorf ("expected %v HTLCs, got %v, %v" ,
2150+ expected , numHtlcs ,
2151+ spew .Sdump (toProtoJSON (t , listChansResp )))
2152+ }
2153+
2154+ return nil
2155+ }, defaultTimeout )
2156+ require .NoError (t , err )
2157+ }
2158+
21312159func assertNumHtlcs (t * testing.T , node * HarnessNode , expected int ) {
21322160 t .Helper ()
21332161
You can’t perform that action at this time.
0 commit comments