]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add TLV suffix to PackageTemplate
authorMatt Corallo <git@bluematt.me>
Wed, 26 May 2021 03:06:12 +0000 (03:06 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 27 May 2021 21:41:07 +0000 (21:41 +0000)
lightning/src/chain/package.rs

index 2e1e50371dc569d4a1f22b937da2ec7e661bbae6..de5a42857e5131e7eb9085b5f8a37e3fa9141c32 100644 (file)
@@ -703,10 +703,11 @@ impl Writeable for PackageTemplate {
                        outpoint.write(writer)?;
                        rev_outp.write(writer)?;
                }
-               self.soonest_conf_deadline.write(writer)?;
-               self.feerate_previous.write(writer)?;
-               self.height_timer.write(writer)?;
-               self.height_original.write(writer)?;
+               write_tlv_fields!(writer, {
+                       (0, self.soonest_conf_deadline),
+                       (2, self.feerate_previous),
+                       (4, self.height_original),
+               }, { (6, self.height_timer) });
                Ok(())
        }
 }
@@ -730,10 +731,15 @@ impl Readable for PackageTemplate {
                                PackageSolvingData::HolderFundingOutput(..) => { (PackageMalleability::Untractable, false) },
                        }
                } else { return Err(DecodeError::InvalidValue); };
-               let soonest_conf_deadline = Readable::read(reader)?;
-               let feerate_previous = Readable::read(reader)?;
-               let height_timer = Readable::read(reader)?;
-               let height_original = Readable::read(reader)?;
+               let mut soonest_conf_deadline = 0;
+               let mut feerate_previous = 0;
+               let mut height_timer = None;
+               let mut height_original = 0;
+               read_tlv_fields!(reader, {
+                       (0, soonest_conf_deadline),
+                       (2, feerate_previous),
+                       (4, height_original)
+               }, { (6, height_timer) });
                Ok(PackageTemplate {
                        inputs,
                        malleability,