]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Fix race in C++ demo where num_txs_broadcasted ++s before =0s
authorMatt Corallo <git@bluematt.me>
Tue, 8 Jun 2021 18:01:37 +0000 (18:01 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 8 Jun 2021 18:02:24 +0000 (18:02 +0000)
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();
        }