@@ -1150,10 +1150,10 @@ impl Writeable for InvoiceRequestFields {
1150
1150
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
1151
1151
write_tlv_fields ! ( writer, {
1152
1152
( 0 , self . payer_id, required) ,
1153
- ( 2 , self . amount_msats, option) ,
1153
+ ( 2 , self . amount_msats. map ( |v| HighZeroBytesDroppedBigSize ( v ) ) , option) ,
1154
1154
( 4 , WithoutLength ( & self . features) , required) ,
1155
- ( 6 , self . quantity, option) ,
1156
- ( 8 , self . payer_note_truncated, option) ,
1155
+ ( 6 , self . quantity. map ( |v| HighZeroBytesDroppedBigSize ( v ) ) , option) ,
1156
+ ( 8 , self . payer_note_truncated. as_ref ( ) . map ( |s| WithoutLength ( & s . 0 ) ) , option) ,
1157
1157
} ) ;
1158
1158
Ok ( ( ) )
1159
1159
}
@@ -1163,15 +1163,16 @@ impl Readable for InvoiceRequestFields {
1163
1163
fn read < R : io:: Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
1164
1164
_init_and_read_len_prefixed_tlv_fields ! ( reader, {
1165
1165
( 0 , payer_id, required) ,
1166
- ( 2 , amount_msats, option) ,
1166
+ ( 2 , amount_msats, ( option, encoding : ( u64 , HighZeroBytesDroppedBigSize ) ) ) ,
1167
1167
( 4 , features, ( option, encoding: ( InvoiceRequestFeatures , WithoutLength ) ) ) ,
1168
- ( 6 , quantity, option) ,
1169
- ( 8 , payer_note_truncated, option) ,
1168
+ ( 6 , quantity, ( option, encoding : ( u64 , HighZeroBytesDroppedBigSize ) ) ) ,
1169
+ ( 8 , payer_note_truncated, ( option, encoding : ( String , WithoutLength ) ) ) ,
1170
1170
} ) ;
1171
1171
let features = features. unwrap_or ( InvoiceRequestFeatures :: empty ( ) ) ;
1172
1172
1173
1173
Ok ( InvoiceRequestFields {
1174
- payer_id : payer_id. 0 . unwrap ( ) , amount_msats, features, quantity, payer_note_truncated,
1174
+ payer_id : payer_id. 0 . unwrap ( ) , amount_msats, features, quantity,
1175
+ payer_note_truncated : payer_note_truncated. map ( |s| UntrustedString ( s) ) ,
1175
1176
} )
1176
1177
}
1177
1178
}
0 commit comments