@@ -275,34 +275,48 @@ impl<T: Time> Writeable for ScorerUsingTime<T> {
275275 #[ inline]
276276 fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
277277 self . params . write ( w) ?;
278- self . channel_failures . write ( w)
278+ self . channel_failures . write ( w) ?;
279+ write_tlv_fields ! ( w, { } ) ;
280+ Ok ( ( ) )
279281 }
280282}
281283
282284impl < T : Time > Readable for ScorerUsingTime < T > {
283285 #[ inline]
284286 fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
285- Ok ( Self {
287+ let res = Ok ( Self {
286288 params : Readable :: read ( r) ?,
287289 channel_failures : Readable :: read ( r) ?,
288- } )
290+ } ) ;
291+ read_tlv_fields ! ( r, { } ) ;
292+ res
289293 }
290294}
291295
292296impl < T : Time > Writeable for ChannelFailure < T > {
293297 #[ inline]
294298 fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
295- self . undecayed_penalty_msat . write ( w) ?;
296- ( T :: duration_since_epoch ( ) - self . last_failed . elapsed ( ) ) . write ( w)
299+ let duration_since_epoch = T :: duration_since_epoch ( ) - self . last_failed . elapsed ( ) ;
300+ write_tlv_fields ! ( w, {
301+ ( 0 , self . undecayed_penalty_msat, required) ,
302+ ( 2 , duration_since_epoch, required) ,
303+ } ) ;
304+ Ok ( ( ) )
297305 }
298306}
299307
300308impl < T : Time > Readable for ChannelFailure < T > {
301309 #[ inline]
302310 fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
311+ let mut undecayed_penalty_msat = 0 ;
312+ let mut duration_since_epoch = Duration :: from_secs ( 0 ) ;
313+ read_tlv_fields ! ( r, {
314+ ( 0 , undecayed_penalty_msat, required) ,
315+ ( 2 , duration_since_epoch, required) ,
316+ } ) ;
303317 Ok ( Self {
304- undecayed_penalty_msat : Readable :: read ( r ) ? ,
305- last_failed : T :: now ( ) - ( T :: duration_since_epoch ( ) - Readable :: read ( r ) ? ) ,
318+ undecayed_penalty_msat,
319+ last_failed : T :: now ( ) - ( T :: duration_since_epoch ( ) - duration_since_epoch ) ,
306320 } )
307321 }
308322}
0 commit comments