X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fdemo.cpp;h=a11c4bf9ccd6439e336fceb41543be23ba7a5351;hp=e7b596b0199a6e72a36f50c37ddcf9b45192c25d;hb=aa7eb7c09b3d01dc125f42efed8d730c2062e4c4;hpb=9e501cbbcde7b6624ec03372452e915967e84064 diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index e7b596b..a11c4bf 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -242,6 +242,9 @@ public: if (peers_1->datalen == 0 && peers_2->datalen == 0) { break; } std::this_thread::yield(); } + // Note that the above is somewhat race-y, as node 2 may still think its connected. + // Thus, make sure any connections are disconnected on its end as well. + PeerManager_disconnect_by_node_id(&net2, ChannelManager_get_our_node_id(&cm1), false); // Finally make an actual connection and keep it this time assert(!socket_connect(node1_handler, ChannelManager_get_our_node_id(&cm2), (sockaddr*)&listen_addr, sizeof(listen_addr)));