]> git.bitcoin.ninja Git - rust-lightning/commitdiff
[fuzz] Do not fail in FST if a channel is closed before we fund it
authorMatt Corallo <git@bluematt.me>
Wed, 21 Apr 2021 00:35:23 +0000 (00:35 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 31 May 2021 18:20:22 +0000 (18:20 +0000)
fuzz/src/full_stack.rs

index 52b37a10f23bac6ad4cd8330ea47f7346cc7be84..0613d3a0aca965b3a47caf99068d1701bb46d69c 100644 (file)
@@ -39,6 +39,7 @@ use lightning::ln::msgs::DecodeError;
 use lightning::routing::router::get_route;
 use lightning::routing::network_graph::NetGraphMsgHandler;
 use lightning::util::config::UserConfig;
+use lightning::util::errors::APIError;
 use lightning::util::events::Event;
 use lightning::util::enforcing_trait_impls::EnforcingSigner;
 use lightning::util::logger::Logger;
@@ -531,7 +532,13 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
                                                        continue 'outer_loop;
                                                }
                                        };
-                                       channelmanager.funding_transaction_generated(&funding_generation.0, tx.clone()).unwrap();
+                                       if let Err(e) = channelmanager.funding_transaction_generated(&funding_generation.0, tx.clone()) {
+                                               // It's possible the channel has been closed in the mean time, but any other
+                                               // failure may be a bug.
+                                               if let APIError::ChannelUnavailable { err } = e {
+                                                       assert_eq!(err, "No such channel");
+                                               } else { panic!(); }
+                                       }
                                        pending_funding_signatures.insert(funding_output, tx);
                                }
                        },