+ std::cout << __FILE__ << ":" << __LINE__ << " - " << "Transaction was broadcast!" << std::endl;
+
+ // Note that the channel ID is the same as the channel txid reversed as the output index is 0
+ uint8_t expected_chan_id[32];
+ for (int i = 0; i < 32; i++) { expected_chan_id[i] = channel_open_txid[31-i]; }
+
+ std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting ChannelPending event..." << std::endl;
+ while (true) {
+ EventQueue queue;
+ LDKEventHandler handler = { .this_arg = &queue, .handle_event = handle_event, .free = NULL };
+ ev1.process_pending_events(handler);
+ if (queue.events.size() == 1) {
+ assert(queue.events[0]->tag == LDKEvent_ChannelPending);
+ assert(!memcmp(queue.events[0]->channel_pending.channel_id.data, expected_chan_id, 32));
+ break;
+ }
+ std::this_thread::yield();
+ }
+ std::cout << __FILE__ << ":" << __LINE__ << " - " << "Received ChannelPending event!" << std::endl;
+
+ LDK::EventsProvider ev2 = ChannelManager_as_EventsProvider(&cm2);
+ std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting ChannelPending event..." << std::endl;
+ while (true) {
+ EventQueue queue;
+ LDKEventHandler handler = { .this_arg = &queue, .handle_event = handle_event, .free = NULL };
+ ev2.process_pending_events(handler);
+ if (queue.events.size() == 1) {
+ assert(queue.events[0]->tag == LDKEvent_ChannelPending);
+ assert(!memcmp(queue.events[0]->channel_pending.channel_id.data, expected_chan_id, 32));
+ break;
+ }
+ std::this_thread::yield();
+ }
+ std::cout << __FILE__ << ":" << __LINE__ << " - " << "Received ChannelPending event!" << std::endl;