Merge pull request #593 from TheBlueMatt/2020-04-par-fuzz-check
[rust-lightning] / lightning / src / util / events.rs
index 2c00a133575d60d9923f1e9afb0501b9cc4fa706..ca6355af001e5eb7d05a96a7ffa22548c9340d87 100644 (file)
@@ -55,6 +55,9 @@ pub enum Event {
        /// ChannelManager::fail_htlc_backwards to free up resources for this HTLC.
        /// The amount paid should be considered 'incorrect' when it is less than or more than twice
        /// the amount expected.
+       /// If you fail to call either ChannelManager::claim_funds or
+       /// ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
+       /// automatically failed.
        PaymentReceived {
                /// The hash for which the preimage should be handed to the ChannelManager.
                payment_hash: PaymentHash,
@@ -96,6 +99,8 @@ pub enum Event {
                rejected_by_dest: bool,
 #[cfg(test)]
                error_code: Option<u16>,
+#[cfg(test)]
+               error_data: Option<Vec<u8>>,
        },
        /// Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
        /// time in the future.
@@ -142,12 +147,16 @@ impl Writeable for Event {
                        &Event::PaymentFailed { ref payment_hash, ref rejected_by_dest,
                                #[cfg(test)]
                                ref error_code,
+                               #[cfg(test)]
+                               ref error_data,
                        } => {
                                4u8.write(writer)?;
                                payment_hash.write(writer)?;
                                rejected_by_dest.write(writer)?;
                                #[cfg(test)]
                                error_code.write(writer)?;
+                               #[cfg(test)]
+                               error_data.write(writer)?;
                        },
                        &Event::PendingHTLCsForwardable { time_forwardable: _ } => {
                                5u8.write(writer)?;
@@ -186,6 +195,8 @@ impl MaybeReadable for Event {
                                        rejected_by_dest: Readable::read(reader)?,
                                        #[cfg(test)]
                                        error_code: Readable::read(reader)?,
+                                       #[cfg(test)]
+                                       error_data: Readable::read(reader)?,
                                })),
                        5u8 => Ok(Some(Event::PendingHTLCsForwardable {
                                        time_forwardable: Duration::from_secs(0)