Panic on txn with value > 21mill in ChannelMonitor::block_connected
[rust-lightning] / fuzz / src / full_stack.rs
index 19dc28042636aaf3c33c3bdedee14c52848b712e..5aa6d94ed81f47d796206673e02e96a23833a636 100644 (file)
@@ -485,6 +485,12 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
                                } else {
                                        let txres: Result<Transaction, _> = deserialize(get_slice!(txlen));
                                        if let Ok(tx) = txres {
+                                               let mut output_val = 0;
+                                               for out in tx.output.iter() {
+                                                       if out.value > 21_000_000_0000_0000 { return; }
+                                                       output_val += out.value;
+                                                       if output_val > 21_000_000_0000_0000 { return; }
+                                               }
                                                loss_detector.connect_block(&[tx]);
                                        } else {
                                                return;