Skip to content

Commit 61f3b55

Browse files
committed
[Java] Add a simple read lock call in HumanObjectPeerTest
1 parent a622cc2 commit 61f3b55

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/java/org/ldk/HumanObjectPeerTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,11 @@ private void setup_route_handler() {
399399
this.payer = InvoicePayer.of(this.chan_manager.as_Payer(), Router.new_impl(new Router.RouterInterface() {
400400
@Override
401401
public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters params, byte[] payment_hash, ChannelDetails[] first_hops, Score scorer) {
402-
return UtilMethods.find_route(payer, params, router, first_hops, logger, scorer, new byte[32]);
402+
// Take a read lock on the NetworkGraph just to make sure we even can.
403+
try (ReadOnlyNetworkGraph graph = router.read_only()) {
404+
assert graph.channel(424242) == null;
405+
return UtilMethods.find_route(payer, params, router, first_hops, logger, scorer, new byte[32]);
406+
}
403407
}
404408
}), MultiThreadedLockableScore.of(Score.new_impl(new Score.ScoreInterface() {
405409
@Override public void payment_path_failed(RouteHop[] path, long scid) {}

0 commit comments

Comments
 (0)