@@ -18,30 +18,38 @@ use crate::api::get_payment_details::{
1818 handle_get_payment_details_request, GET_PAYMENT_DETAILS_PATH ,
1919} ;
2020use crate :: api:: list_channels:: { handle_list_channels_request, LIST_CHANNELS_PATH } ;
21+ use crate :: api:: list_forwarded_payments:: {
22+ handle_list_forwarded_payments_request, LIST_FORWARDED_PAYMENTS_PATH ,
23+ } ;
2124use crate :: api:: list_payments:: { handle_list_payments_request, LIST_PAYMENTS_PATH } ;
2225use crate :: api:: onchain_receive:: { handle_onchain_receive_request, ONCHAIN_RECEIVE_PATH } ;
2326use crate :: api:: onchain_send:: { handle_onchain_send_request, ONCHAIN_SEND_PATH } ;
2427use crate :: api:: open_channel:: { handle_open_channel, OPEN_CHANNEL_PATH } ;
2528use crate :: api:: update_channel_config:: {
2629 handle_update_channel_config_request, UPDATE_CHANNEL_CONFIG_PATH ,
2730} ;
31+ use crate :: io:: paginated_kv_store:: PaginatedKVStore ;
2832use std:: future:: Future ;
2933use std:: pin:: Pin ;
3034use std:: sync:: Arc ;
3135
3236#[ derive( Clone ) ]
3337pub struct NodeService {
3438 node : Arc < Node > ,
39+ paginated_kv_store : Arc < dyn PaginatedKVStore + Send + Sync > ,
3540}
3641
3742impl NodeService {
38- pub ( crate ) fn new ( node : Arc < Node > ) -> Self {
39- Self { node }
43+ pub ( crate ) fn new (
44+ node : Arc < Node > , paginated_kv_store : Arc < dyn PaginatedKVStore + Send + Sync > ,
45+ ) -> Self {
46+ Self { node, paginated_kv_store }
4047 }
4148}
4249
4350pub ( crate ) struct Context {
4451 pub ( crate ) node : Arc < Node > ,
52+ pub ( crate ) paginated_kv_store : Arc < dyn PaginatedKVStore + Send + Sync > ,
4553}
4654
4755impl Service < Request < Incoming > > for NodeService {
@@ -50,7 +58,10 @@ impl Service<Request<Incoming>> for NodeService {
5058 type Future = Pin < Box < dyn Future < Output = Result < Self :: Response , Self :: Error > > + Send > > ;
5159
5260 fn call ( & self , req : Request < Incoming > ) -> Self :: Future {
53- let context = Context { node : Arc :: clone ( & self . node ) } ;
61+ let context = Context {
62+ node : Arc :: clone ( & self . node ) ,
63+ paginated_kv_store : Arc :: clone ( & self . paginated_kv_store ) ,
64+ } ;
5465 // Exclude '/' from path pattern matching.
5566 match & req. uri ( ) . path ( ) [ 1 ..] {
5667 GET_NODE_INFO => Box :: pin ( handle_request ( context, req, handle_get_node_info_request) ) ,
@@ -85,6 +96,9 @@ impl Service<Request<Incoming>> for NodeService {
8596 LIST_PAYMENTS_PATH => {
8697 Box :: pin ( handle_request ( context, req, handle_list_payments_request) )
8798 } ,
99+ LIST_FORWARDED_PAYMENTS_PATH => {
100+ Box :: pin ( handle_request ( context, req, handle_list_forwarded_payments_request) )
101+ } ,
88102 path => {
89103 let error = format ! ( "Unknown request: {}" , path) . into_bytes ( ) ;
90104 Box :: pin ( async {
0 commit comments