Merge pull request #27 from TheBlueMatt/main
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Tue, 8 Jun 2021 18:17:35 +0000 (18:17 +0000)
committerGitHub <noreply@github.com>
Tue, 8 Jun 2021 18:17:35 +0000 (18:17 +0000)
Fix race in C++ demo where num_txs_broadcasted ++s before =0s

lightning-c-bindings/demo.cpp

index de1e46c4a969ccca29380e23212f2a804f6a1971..1d83b21003966ff1d520e764a33265ea052a8403 100644 (file)
@@ -641,10 +641,10 @@ int main() {
        }
 
        // Actually close the channel
+       num_txs_broadcasted = 0;
        close_res = ChannelManager_close_channel(&cm1, &chan_id);
        assert(close_res->result_ok);
        PeerManager_process_events(&net1);
-       num_txs_broadcasted = 0;
        while (num_txs_broadcasted != 2) {
                std::this_thread::yield();
        }