- // Take a read lock on the NetworkGraph just to make sure we even can.
- try (ReadOnlyNetworkGraph graph = router.read_only()) {
- assert graph.channel(424242) == null;
- return UtilMethods.find_route(payer, params, router, first_hops, logger, scorer, new byte[32]);
+ while (true) {
+ try (ReadOnlyNetworkGraph graph = router.read_only()) {
+ assert graph.channel(424242) == null;
+ long[] channels = graph.list_channels();
+ if (channels.length != 1) {
+ // If we're using a NioPeerHandler, the handling of announcement signatures and
+ // channel broadcasting may be done async, so just wait until the channel shows up.
+ // TODO: Once https://github.com/lightningdevkit/rust-lightning/pull/1666 lands swap this for a continue and add the assertion
+ //assert !use_nio_peer_handler;
+ break;
+ }
+ ChannelInfo chan = graph.channel(channels[0]);
+ assert Arrays.equals(chan.get_node_one().as_slice(), chan.get_node_one().write());
+ assert Arrays.equals(chan.get_node_one().as_slice(), chan_manager.get_our_node_id()) ||
+ Arrays.equals(chan.get_node_two().as_slice(), chan_manager.get_our_node_id());
+ break;
+ }