X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fser_macros.rs;h=351c2a1f5e25e4d21ad0c999e2f064bf366a6f35;hb=29e34c8a10cf813116c9251188a86978cc97e259;hp=816426b1133cb21a1e703129e6aecfa884f2c00c;hpb=3676a056c85f54347e7e079e913317a79e26a2ae;p=rust-lightning diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index 816426b1..351c2a1f 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -99,7 +99,7 @@ macro_rules! check_tlv_order { #[allow(unused_comparisons)] // Note that $type may be 0 making the second comparison always true let invalid_order = ($last_seen_type.is_none() || $last_seen_type.unwrap() < $type) && $typ.0 > $type; if invalid_order { - $field = $default; + $field = $default.into(); } }}; ($last_seen_type: expr, $typ: expr, $type: expr, $field: ident, required) => {{ @@ -128,7 +128,7 @@ macro_rules! check_missing_tlv { #[allow(unused_comparisons)] // Note that $type may be 0 making the second comparison always true let missing_req_type = $last_seen_type.is_none() || $last_seen_type.unwrap() < $type; if missing_req_type { - $field = $default; + $field = $default.into(); } }}; ($last_seen_type: expr, $type: expr, $field: ident, required) => {{ @@ -349,7 +349,7 @@ macro_rules! read_tlv_fields { macro_rules! init_tlv_based_struct_field { ($field: ident, (default_value, $default: expr)) => { - $field + $field.0.unwrap() }; ($field: ident, option) => { $field @@ -364,7 +364,7 @@ macro_rules! init_tlv_based_struct_field { macro_rules! init_tlv_field_var { ($field: ident, (default_value, $default: expr)) => { - let mut $field = $default; + let mut $field = ::util::ser::OptionDeserWrapper(None); }; ($field: ident, required) => { let mut $field = ::util::ser::OptionDeserWrapper(None);