@@ -411,32 +411,6 @@ static struct command_result *json_listchannels(struct command *cmd,
411411 return send_outreq (cmd -> plugin , req );
412412}
413413
414- static bool node_in_paginator (struct command * cmd , struct node_id * node_id )
415- {
416- struct jsonrpc_paginator * p ;
417-
418- p = cmd -> paginator ;
419- if (p ) {
420- if (p -> batch ) {
421- const char * target_id ;
422- const char * id ;
423- size_t i ;
424-
425- target_id = node_id_to_hexstr (cmd , node_id );
426- /* FIXME: can we use the hash map to speed up the seach */
427- for (i = 0 ; i < tal_count (p -> batch ); i ++ ) {
428- id = p -> batch [i ];
429- if (strcmp (id , target_id ) == 0 )
430- goto done ;
431- plugin_log (cmd -> plugin , LOG_DBG , "not match %s != %s" , target_id , id );
432- }
433- }
434- return false;
435- }
436- done :
437- return true;
438- }
439-
440414static void json_add_node (struct command * cmd ,
441415 struct json_stream * js ,
442416 const struct gossmap * gossmap ,
@@ -446,8 +420,6 @@ static void json_add_node(struct command *cmd,
446420 u8 * nannounce ;
447421
448422 gossmap_node_get_id (gossmap , n , & node_id );
449- if (!node_in_paginator (cmd , & node_id ))
450- return ;
451423 json_object_start (js , NULL );
452424 json_add_node_id (js , "nodeid" , & node_id );
453425 nannounce = gossmap_node_get_announce (tmpctx , gossmap , n );
@@ -532,6 +504,17 @@ static struct command_result *json_listnodes(struct command *cmd,
532504 struct gossmap_node * n = gossmap_find_node (gossmap , id );
533505 if (n )
534506 json_add_node (cmd , js , gossmap , n );
507+ } else if (cmd -> paginator ) {
508+ const char * * batch = cmd -> paginator -> batch ;
509+ for (size_t i = 0 ; i < tal_count (batch ); i ++ ) {
510+ const char * idstr = batch [i ];
511+ id = tal (tmpctx , struct node_id );
512+ ; node_id_from_hexstr (idstr , sizeof (idstr ), id );
513+ struct gossmap_node * n = gossmap_find_node (gossmap , id );
514+ if (n )
515+ json_add_node (cmd , js , gossmap , n );
516+ tal_free (id );
517+ }
535518 } else {
536519 for (struct gossmap_node * n = gossmap_first_node (gossmap );
537520 n ;
0 commit comments