]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Ignore unknown Events serialized with an odd type value.
authorMatt Corallo <git@bluematt.me>
Thu, 15 Jul 2021 16:30:52 +0000 (16:30 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 28 Jul 2021 17:35:09 +0000 (17:35 +0000)
This should provide some additional future extensibility, allowing
for new informational events which can be safely ignored to be
ignored by older versions.

lightning/src/util/events.rs

index 876dfe6abb551f359a6c67c60fe05c1d104b81ed..3376701042e2e5c66985b8f4f82d4a93b25c4136 100644 (file)
@@ -312,6 +312,8 @@ impl MaybeReadable for Event {
                                };
                                f()
                        },
+                       // Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
+                       x if x % 2 == 1 => Ok(None),
                        _ => Err(msgs::DecodeError::InvalidValue)
                }
        }