From: Matt Corallo Date: Wed, 26 May 2021 03:06:12 +0000 (+0000) Subject: Add TLV suffix to PackageTemplate X-Git-Tag: v0.0.98~14^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=a7494228c91ab4053fd1032b7645f735353e65f5;p=rust-lightning Add TLV suffix to PackageTemplate --- diff --git a/lightning/src/chain/package.rs b/lightning/src/chain/package.rs index 2e1e50371..de5a42857 100644 --- a/lightning/src/chain/package.rs +++ b/lightning/src/chain/package.rs @@ -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,