@@ -168,7 +168,8 @@ public MonitorEvent[] release_pending_monitor_events() {
168168 final KeysManager explicit_keys_manager ;
169169 final KeysInterface keys_interface ;
170170 final ChainMonitor chain_monitor ;
171- final NetGraphMsgHandler router ;
171+ final NetworkGraph router ;
172+ NetGraphMsgHandler route_handler ;
172173 final Watch chain_watch ;
173174 final HashSet <String > filter_additions ;
174175 final Option_FilterZ filter ;
@@ -209,7 +210,7 @@ private Peer(Object _dummy, byte seed) {
209210 this .seed = seed ;
210211 Persist persister = Persist .new_impl (new Persist .PersistInterface () {
211212 @ Override
212- public Result_NoneChannelMonitorUpdateErrZ persist_new_channel (OutPoint id , ChannelMonitor data ) {
213+ public Result_NoneChannelMonitorUpdateErrZ persist_new_channel (OutPoint id , ChannelMonitor data , MonitorUpdateId update_id ) {
213214 synchronized (monitors ) {
214215 String key = Arrays .toString (id .to_channel_id ());
215216 assert monitors .put (key , data ) == null ;
@@ -221,7 +222,7 @@ public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint id, Chan
221222 }
222223
223224 @ Override
224- public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel (OutPoint id , ChannelMonitorUpdate update , ChannelMonitor data ) {
225+ public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel (OutPoint id , ChannelMonitorUpdate update , ChannelMonitor data , MonitorUpdateId update_id ) {
225226 synchronized (monitors ) {
226227 String key = Arrays .toString (id .to_channel_id ());
227228 assert monitors .put (key , data ) != null ;
@@ -268,7 +269,8 @@ public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint id,
268269 this .keys_interface = keys .as_KeysInterface ();
269270 this .explicit_keys_manager = keys ;
270271 }
271- this .router = NetGraphMsgHandler .of (NetworkGraph .of (new byte [32 ]), Option_AccessZ .some (Access .new_impl (new Access .AccessInterface () {
272+ this .router = NetworkGraph .of (new byte [32 ]);
273+ this .route_handler = NetGraphMsgHandler .of (this .router , Option_AccessZ .some (Access .new_impl (new Access .AccessInterface () {
272274 @ Override
273275 public Result_TxOutAccessErrorZ get_utxo (byte [] genesis_hash , long short_channel_id ) {
274276 // We don't exchange any gossip, so should never actually get called, but providing a Some(Access)
@@ -333,9 +335,8 @@ private void bind_nio() {
333335 Peer (byte seed ) {
334336 this (null , seed );
335337 if (use_chan_manager_constructor ) {
336- NetGraphMsgHandler route_handler = null ;
337- if (!use_ignore_handler ) {
338- route_handler = router ;
338+ if (use_ignore_handler ) {
339+ this .route_handler = null ;
339340 }
340341 this .constructor = new ChannelManagerConstructor (Network .LDKNetwork_Bitcoin , UserConfig .with_default (), new byte [32 ], 0 ,
341342 this .keys_interface , this .fee_estimator , this .chain_monitor , route_handler , this .tx_broadcaster , this .logger );
@@ -355,7 +356,7 @@ private void bind_nio() {
355356 ChainParameters params = ChainParameters .of (Network .LDKNetwork_Bitcoin , BestBlock .of (new byte [32 ], 0 ));
356357 this .chan_manager = ChannelManager .of (this .fee_estimator , chain_watch , tx_broadcaster , logger , this .keys_interface , UserConfig .with_default (), params );
357358 byte [] random_data = keys_interface .get_secure_random_bytes ();
358- this .peer_manager = PeerManager .of (chan_manager .as_ChannelMessageHandler (), router .as_RoutingMessageHandler (), keys_interface .get_node_secret (), random_data , logger , this .custom_message_handler );
359+ this .peer_manager = PeerManager .of (chan_manager .as_ChannelMessageHandler (), route_handler .as_RoutingMessageHandler (), keys_interface .get_node_secret (), random_data , logger , this .custom_message_handler );
359360 }
360361
361362 this .node_id = chan_manager .get_our_node_id ();
@@ -374,8 +375,11 @@ private void bind_nio() {
374375 if (this .filter instanceof Option_FilterZ .Some ) {
375376 filter_nullable = ((Option_FilterZ .Some ) this .filter ).some ;
376377 }
378+ if (use_ignore_handler ) {
379+ this .route_handler = null ;
380+ }
377381 this .constructor = new ChannelManagerConstructor (serialized , monitors , this .keys_interface ,
378- this .fee_estimator , this .chain_monitor , filter_nullable , this .router , this .tx_broadcaster , this .logger );
382+ this .fee_estimator , this .chain_monitor , filter_nullable , this .route_handler , this .tx_broadcaster , this .logger );
379383 constructor .chain_sync_completed (new ChannelManagerConstructor .EventHandler () {
380384 @ Override public void handle_event (Event event ) {
381385 synchronized (pending_manager_events ) {
@@ -417,7 +421,7 @@ private void bind_nio() {
417421 this .chan_manager = ((Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ .Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_OK ) read_res ).res .get_b ();
418422 this .chain_watch .watch_channel (monitors [0 ].get_funding_txo ().get_a (), monitors [0 ]);
419423 byte [] random_data = keys_interface .get_secure_random_bytes ();
420- this .peer_manager = PeerManager .of (chan_manager .as_ChannelMessageHandler (), router .as_RoutingMessageHandler (), keys_interface .get_node_secret (), random_data , logger , this .custom_message_handler );
424+ this .peer_manager = PeerManager .of (chan_manager .as_ChannelMessageHandler (), route_handler .as_RoutingMessageHandler (), keys_interface .get_node_secret (), random_data , logger , this .custom_message_handler );
421425 if (!break_cross_peer_refs && (use_manual_watch || use_km_wrapper )) {
422426 // When we pass monitors[0] into chain_watch.watch_channel we create a reference from the new Peer to a
423427 // field in the old peer, preventing freeing of the original Peer until the new Peer is freed. Thus, we
@@ -741,9 +745,11 @@ TestState do_test_message_handler() throws InterruptedException {
741745 InvoiceFeatures invoice_features = ((Result_InvoiceSignOrCreationErrorZ .Result_InvoiceSignOrCreationErrorZ_OK ) invoice ).res .features ();
742746 RouteHint [] route_hints = ((Result_InvoiceSignOrCreationErrorZ .Result_InvoiceSignOrCreationErrorZ_OK ) invoice ).res .route_hints ();
743747
744- Result_RouteLightningErrorZ route_res = UtilMethods .get_route (
745- peer1 .chan_manager .get_our_node_id (), peer1 .router .get_network_graph (), peer2 .node_id , invoice_features ,
746- peer1_chans , route_hints , 10000000 , 42 , peer1 .logger , Scorer .with_default ().as_Score ());
748+ Payee payee = Payee .of (peer2 .node_id , invoice_features , route_hints , Option_u64Z .none ());
749+ RouteParameters route_params = RouteParameters .of (payee , 10000000 , 42 );
750+ Result_RouteLightningErrorZ route_res = UtilMethods .find_route (
751+ peer1 .chan_manager .get_our_node_id (), route_params , peer1 .router ,
752+ peer1_chans , peer1 .logger , Scorer .with_default ().as_Score ());
747753 assert route_res instanceof Result_RouteLightningErrorZ .Result_RouteLightningErrorZ_OK ;
748754 Route route = ((Result_RouteLightningErrorZ .Result_RouteLightningErrorZ_OK ) route_res ).res ;
749755 assert route .get_paths ().length == 1 ;
@@ -758,7 +764,7 @@ TestState do_test_message_handler() throws InterruptedException {
758764 hop_pubkey [0 ] = 3 ;
759765 hop_pubkey [1 ] = 42 ;
760766 hops [0 ][0 ] = RouteHop .of (hop_pubkey , NodeFeatures .known (), 42 , ChannelFeatures .known (), 100 , 0 );
761- Route r2 = Route .of (hops );
767+ Route r2 = Route .of (hops , payee );
762768 payment_res = peer1 .chan_manager .send_payment (r2 , payment_hash , payment_secret );
763769 assert payment_res instanceof Result_PaymentIdPaymentSendFailureZ .Result_PaymentIdPaymentSendFailureZ_Err ;
764770
0 commit comments