@@ -1199,7 +1199,7 @@ impl MaybeReadable for Event {
1199
1199
let mut payment_id = None ;
1200
1200
read_tlv_fields ! ( reader, {
1201
1201
( 0 , payment_hash, required) ,
1202
- ( 1 , network_update, upgradable_required ) ,
1202
+ ( 1 , network_update, upgradable_option ) ,
1203
1203
( 2 , payment_failed_permanently, required) ,
1204
1204
( 5 , path, vec_type) ,
1205
1205
( 7 , short_channel_id, option) ,
@@ -1285,15 +1285,14 @@ impl MaybeReadable for Event {
1285
1285
( 2 , reason, upgradable_required) ,
1286
1286
( 3 , user_channel_id_high_opt, option) ,
1287
1287
} ) ;
1288
- if reason. is_none ( ) { return Ok ( None ) ; }
1289
1288
1290
1289
// `user_channel_id` used to be a single u64 value. In order to remain
1291
1290
// backwards compatible with versions prior to 0.0.113, the u128 is serialized
1292
1291
// as two separate u64 values.
1293
1292
let user_channel_id = ( user_channel_id_low_opt. unwrap_or ( 0 ) as u128 ) +
1294
1293
( ( user_channel_id_high_opt. unwrap_or ( 0 ) as u128 ) << 64 ) ;
1295
1294
1296
- Ok ( Some ( Event :: ChannelClosed { channel_id, user_channel_id, reason : reason . unwrap ( ) } ) )
1295
+ Ok ( Some ( Event :: ChannelClosed { channel_id, user_channel_id, reason : _init_tlv_based_struct_field ! ( reason , upgradable_required ) } ) )
1297
1296
} ;
1298
1297
f ( )
1299
1298
} ,
@@ -1358,11 +1357,10 @@ impl MaybeReadable for Event {
1358
1357
( 2 , purpose, upgradable_required) ,
1359
1358
( 4 , amount_msat, required) ,
1360
1359
} ) ;
1361
- if purpose. is_none ( ) { return Ok ( None ) ; }
1362
1360
Ok ( Some ( Event :: PaymentClaimed {
1363
1361
receiver_node_id,
1364
1362
payment_hash,
1365
- purpose : purpose . unwrap ( ) ,
1363
+ purpose : _init_tlv_based_struct_field ! ( purpose , upgradable_required ) ,
1366
1364
amount_msat,
1367
1365
} ) )
1368
1366
} ;
@@ -1415,17 +1413,10 @@ impl MaybeReadable for Event {
1415
1413
( 0 , prev_channel_id, required) ,
1416
1414
( 2 , failed_next_destination_opt, upgradable_required) ,
1417
1415
} ) ;
1418
- if let Some ( failed_next_destination) = failed_next_destination_opt {
1419
- Ok ( Some ( Event :: HTLCHandlingFailed {
1420
- prev_channel_id,
1421
- failed_next_destination,
1422
- } ) )
1423
- } else {
1424
- // If we fail to read a `failed_next_destination` assume it's because
1425
- // `MaybeReadable::read` returned `Ok(None)`, though it's also possible we
1426
- // were simply missing the field.
1427
- Ok ( None )
1428
- }
1416
+ Ok ( Some ( Event :: HTLCHandlingFailed {
1417
+ prev_channel_id,
1418
+ failed_next_destination : _init_tlv_based_struct_field ! ( failed_next_destination_opt, upgradable_required) ,
1419
+ } ) )
1429
1420
} ;
1430
1421
f ( )
1431
1422
} ,
0 commit comments