PeerManager_disconnect_by_node_id(&net1, ChannelManager_get_our_node_id(&cm2));
assert(!socket_connect(node1_handler, ChannelManager_get_our_node_id(&cm2), (sockaddr*)&listen_addr, sizeof(listen_addr)));
+ while (true) {
+ // Wait for the new connection handshake...
+ LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1);
+ LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2);
+ if (peers_1->datalen == 1 && peers_2->datalen == 1) { break; }
+ std::this_thread::yield();
+ }
+
// Wait for all our sockets to disconnect (making sure we disconnect any new connections)...
while (true) {
PeerManager_disconnect_by_node_id(&net1, ChannelManager_get_our_node_id(&cm2));
}
LDKStr custom_msg_debug(const void *this_arg) {
return LDKStr {
- .chars = NULL, .len = 0, .chars_is_owned = false
+ .chars = (const unsigned char*) "Custom Message", .len = 14, .chars_is_owned = false
};
}
return 42;
}
-struct LDKCResult_RouteLightningErrorZ custom_find_route(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *in_flights) {
+struct LDKCResult_RouteLightningErrorZ custom_find_route(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *in_flights, LDKThirtyTwoBytes payment_id, LDKThirtyTwoBytes payment_hash) {
const LDK::DefaultRouter *router = (LDK::DefaultRouter *)this_arg;
assert(first_hops->datalen == 1);
assert(ChannelDetails_get_is_usable(&first_hops->data[0]));
LDKRouter panic_router = {
.this_arg = NULL,
.find_route = NULL, // Segfault if we ever try to find a route
+ .find_route_with_id = NULL, // Segfault if we ever try to find a route
.free = NULL,
};
const LDK::DefaultRouter default_router_1 = DefaultRouter_new(&net_graph1, logger1, entropy_source1.get_secure_random_bytes(), std::move(scorer_mtx_trait1));
LDKRouter router1 = {
.this_arg = (void*)&default_router_1,
- .find_route = custom_find_route,
+ .find_route = NULL, // LDK currently doesn't use this, its just a default-impl
+ .find_route_with_id = custom_find_route,
.free = NULL,
};