Implement reorg-safety for SpendableOutputDescriptor detection
[rust-lightning] / lightning / src / chain / keysinterface.rs
index 544df015a8f48b404c390a63a909ec7aca3746ed..d023c31de239c1127cf62c63ed1fabc39a6010da 100644 (file)
@@ -37,6 +37,7 @@ use ln::msgs::DecodeError;
 /// spend on-chain. The information needed to do this is provided in this enum, including the
 /// outpoint describing which txid and output index is available, the full output which exists at
 /// that txid/index, and any keys or other information required to sign.
+#[derive(Clone, PartialEq)]
 pub enum SpendableOutputDescriptor {
        /// An output to a script which was provided via KeysInterface, thus you should already know
        /// how to spend it. No keys are provided as rust-lightning was never given any keys - only the
@@ -115,8 +116,8 @@ impl Writeable for SpendableOutputDescriptor {
        }
 }
 
-impl<R: ::std::io::Read> Readable<R> for SpendableOutputDescriptor {
-       fn read(reader: &mut R) -> Result<Self, DecodeError> {
+impl Readable for SpendableOutputDescriptor {
+       fn read<R: ::std::io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
                match Readable::read(reader)? {
                        0u8 => Ok(SpendableOutputDescriptor::StaticOutput {
                                outpoint: Readable::read(reader)?,
@@ -381,8 +382,8 @@ impl Writeable for InMemoryChannelKeys {
        }
 }
 
-impl<R: ::std::io::Read> Readable<R> for InMemoryChannelKeys {
-       fn read(reader: &mut R) -> Result<Self, DecodeError> {
+impl Readable for InMemoryChannelKeys {
+       fn read<R: ::std::io::Read>(reader: &mut R) -> Result<Self, DecodeError> {
                let funding_key = Readable::read(reader)?;
                let revocation_base_key = Readable::read(reader)?;
                let payment_base_key = Readable::read(reader)?;