From 0e88538b783a753a93f17419f5fabbe645fe1fba Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Mon, 20 Feb 2023 12:42:45 -0500 Subject: [PATCH] Disambiguate ignorable and ignorable_option Would rather not rename ignorable to ignorable_required, so rename both of them to upgradable_* --- lightning/src/chain/channelmonitor.rs | 2 +- lightning/src/chain/onchaintx.rs | 2 +- lightning/src/ln/channelmanager.rs | 2 +- lightning/src/routing/gossip.rs | 6 +++--- lightning/src/util/events.rs | 8 ++++---- lightning/src/util/ser_macros.rs | 28 +++++++++++++-------------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 509ebed6f..ea24f8cf6 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -460,7 +460,7 @@ impl MaybeReadable for OnchainEventEntry { (1, transaction, option), (2, height, required), (3, block_hash, option), - (4, event, ignorable), + (4, event, upgradable_required), }); if let Some(ev) = event { Ok(Some(Self { txid, transaction, height, block_hash, event: ev })) diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index 039fb5ff1..23140068a 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -111,7 +111,7 @@ impl MaybeReadable for OnchainEventEntry { (0, txid, required), (1, block_hash, option), (2, height, required), - (4, event, ignorable), + (4, event, upgradable_required), }); if let Some(ev) = event { Ok(Some(Self { txid, height, block_hash, event: ev })) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 577e09844..f659d6318 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -468,7 +468,7 @@ pub(crate) enum MonitorUpdateCompletionAction { impl_writeable_tlv_based_enum_upgradable!(MonitorUpdateCompletionAction, (0, PaymentClaimed) => { (0, payment_hash, required) }, - (2, EmitEvent) => { (0, event, ignorable) }, + (2, EmitEvent) => { (0, event, upgradable_required) }, ); /// State we hold per-peer. diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index cf51b6ab5..957be2951 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -883,9 +883,9 @@ impl Readable for ChannelInfo { (0, features, required), (1, announcement_received_time, (default_value, 0)), (2, node_one, required), - (4, one_to_two_wrap, ignorable), + (4, one_to_two_wrap, upgradable_required), (6, node_two, required), - (8, two_to_one_wrap, ignorable), + (8, two_to_one_wrap, upgradable_required), (10, capacity_sats, required), (12, announcement_message, required), }); @@ -1161,7 +1161,7 @@ impl Readable for NodeInfo { read_tlv_fields!(reader, { (0, _lowest_inbound_channel_fees, option), - (2, announcement_info_wrap, ignorable), + (2, announcement_info_wrap, upgradable_required), (4, channels, vec_type), }); diff --git a/lightning/src/util/events.rs b/lightning/src/util/events.rs index 80ecc2284..70bf07f95 100644 --- a/lightning/src/util/events.rs +++ b/lightning/src/util/events.rs @@ -1199,7 +1199,7 @@ impl MaybeReadable for Event { let mut payment_id = None; read_tlv_fields!(reader, { (0, payment_hash, required), - (1, network_update, ignorable), + (1, network_update, upgradable_required), (2, payment_failed_permanently, required), (5, path, vec_type), (7, short_channel_id, option), @@ -1282,7 +1282,7 @@ impl MaybeReadable for Event { read_tlv_fields!(reader, { (0, channel_id, required), (1, user_channel_id_low_opt, option), - (2, reason, ignorable), + (2, reason, upgradable_required), (3, user_channel_id_high_opt, option), }); if reason.is_none() { return Ok(None); } @@ -1355,7 +1355,7 @@ impl MaybeReadable for Event { read_tlv_fields!(reader, { (0, payment_hash, required), (1, receiver_node_id, option), - (2, purpose, ignorable), + (2, purpose, upgradable_required), (4, amount_msat, required), }); if purpose.is_none() { return Ok(None); } @@ -1413,7 +1413,7 @@ impl MaybeReadable for Event { let mut failed_next_destination_opt = None; read_tlv_fields!(reader, { (0, prev_channel_id, required), - (2, failed_next_destination_opt, ignorable), + (2, failed_next_destination_opt, upgradable_required), }); if let Some(failed_next_destination) = failed_next_destination_opt { Ok(Some(Event::HTLCHandlingFailed { diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index c7dcc8701..3f4b7153a 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -39,10 +39,10 @@ macro_rules! _encode_tlv { field.write($stream)?; } }; - ($stream: expr, $type: expr, $field: expr, ignorable) => { + ($stream: expr, $type: expr, $field: expr, upgradable_required) => { $crate::_encode_tlv!($stream, $type, $field, required); }; - ($stream: expr, $type: expr, $field: expr, ignorable_option) => { + ($stream: expr, $type: expr, $field: expr, upgradable_option) => { $crate::_encode_tlv!($stream, $type, $field, option); }; ($stream: expr, $type: expr, $field: expr, (option, encoding: ($fieldty: ty, $encoding: ident))) => { @@ -161,10 +161,10 @@ macro_rules! _get_varint_length_prefixed_tlv_length { $len.0 += field_len; } }; - ($len: expr, $type: expr, $field: expr, ignorable) => { + ($len: expr, $type: expr, $field: expr, upgradable_required) => { $crate::_get_varint_length_prefixed_tlv_length!($len, $type, $field, required); }; - ($len: expr, $type: expr, $field: expr, ignorable_option) => { + ($len: expr, $type: expr, $field: expr, upgradable_option) => { $crate::_get_varint_length_prefixed_tlv_length!($len, $type, $field, option); }; } @@ -216,10 +216,10 @@ macro_rules! _check_decoded_tlv_order { ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, vec_type) => {{ // no-op }}; - ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, ignorable) => {{ + ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, upgradable_required) => {{ // no-op }}; - ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, ignorable_option) => {{ + ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, upgradable_option) => {{ // no-op }}; ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, (option: $trait: ident $(, $read_arg: expr)?)) => {{ @@ -258,10 +258,10 @@ macro_rules! _check_missing_tlv { ($last_seen_type: expr, $type: expr, $field: ident, option) => {{ // no-op }}; - ($last_seen_type: expr, $type: expr, $field: ident, ignorable) => {{ + ($last_seen_type: expr, $type: expr, $field: ident, upgradable_required) => {{ // no-op }}; - ($last_seen_type: expr, $type: expr, $field: ident, ignorable_option) => {{ + ($last_seen_type: expr, $type: expr, $field: ident, upgradable_option) => {{ // no-op }}; ($last_seen_type: expr, $type: expr, $field: ident, (option: $trait: ident $(, $read_arg: expr)?)) => {{ @@ -292,10 +292,10 @@ macro_rules! _decode_tlv { ($reader: expr, $field: ident, option) => {{ $field = Some($crate::util::ser::Readable::read(&mut $reader)?); }}; - ($reader: expr, $field: ident, ignorable) => {{ + ($reader: expr, $field: ident, upgradable_required) => {{ $field = $crate::util::ser::MaybeReadable::read(&mut $reader)?; }}; - ($reader: expr, $field: ident, ignorable_option) => {{ + ($reader: expr, $field: ident, upgradable_option) => {{ $field = $crate::util::ser::MaybeReadable::read(&mut $reader)?; }}; ($reader: expr, $field: ident, (option: $trait: ident $(, $read_arg: expr)?)) => {{ @@ -635,10 +635,10 @@ macro_rules! _init_tlv_based_struct_field { ($field: ident, option) => { $field }; - ($field: ident, ignorable) => { + ($field: ident, upgradable_required) => { if $field.is_none() { return Ok(None); } else { $field.unwrap() } }; - ($field: ident, ignorable_option) => { + ($field: ident, upgradable_option) => { $field }; ($field: ident, required) => { @@ -670,10 +670,10 @@ macro_rules! _init_tlv_field_var { ($field: ident, option) => { let mut $field = None; }; - ($field: ident, ignorable) => { + ($field: ident, upgradable_required) => { let mut $field = None; }; - ($field: ident, ignorable_option) => { + ($field: ident, upgradable_option) => { let mut $field = None; }; } -- 2.39.5