@@ -6,6 +6,7 @@ use crate::logger::{log_error, Logger};
6
6
use crate :: types:: DynStore ;
7
7
use crate :: Error ;
8
8
9
+ use bitcoin:: secp256k1:: PublicKey ;
9
10
use lightning:: ln:: channelmanager:: PaymentId ;
10
11
use lightning:: ln:: msgs:: DecodeError ;
11
12
use lightning:: ln:: { PaymentHash , PaymentPreimage , PaymentSecret } ;
@@ -213,10 +214,20 @@ pub enum PaymentKind {
213
214
secret : Option < PaymentSecret > ,
214
215
/// The ID of the offer this payment is for.
215
216
offer_id : OfferId ,
216
- /// The payer note for the payment.
217
+ /// The payer note for the payment. Truncated to [PAYER_NOTE_LIMIT] characters.
217
218
///
218
219
/// This will always be `None` for payments serialized with version `v0.3.0`.
220
+ ///
221
+ /// [PAYER_NOTE_LIMIT]: lightning::offers::invoice_request::PAYER_NOTE_LIMIT
219
222
payer_note : Option < UntrustedString > ,
223
+ /// The payers ID for the payment.
224
+ ///
225
+ /// This will always be `None` for payments serialized with version `v0.3.0`.
226
+ payer_id : Option < PublicKey > ,
227
+ /// The quantity of items or units requested in the offer.
228
+ ///
229
+ /// This will always be `None` for payments serialized with version `v0.3.0`.
230
+ quantity : Option < u64 > ,
220
231
} ,
221
232
/// A [BOLT 12] 'refund' payment, i.e., a payment for a [`Refund`].
222
233
///
@@ -233,6 +244,14 @@ pub enum PaymentKind {
233
244
///
234
245
/// This will always be `None` for payments serialized with version `v0.3.0`.
235
246
payer_note : Option < UntrustedString > ,
247
+ /// The payers ID for the refund payment.
248
+ ///
249
+ /// This will always be `None` for payments serialized with version `v0.3.0`.
250
+ payer_id : Option < PublicKey > ,
251
+ /// The quantity of items or units requested in the offer.
252
+ ///
253
+ /// This will always be `None` for payments serialized with version `v0.3.0`.
254
+ quantity : Option < u64 > ,
236
255
} ,
237
256
/// A spontaneous ("keysend") payment.
238
257
Spontaneous {
@@ -258,20 +277,24 @@ impl_writeable_tlv_based_enum!(PaymentKind,
258
277
} ,
259
278
( 6 , Bolt12Offer ) => {
260
279
( 0 , hash, option) ,
280
+ ( 1 , payer_note, option) ,
261
281
( 2 , preimage, option) ,
282
+ ( 3 , payer_id, option) ,
262
283
( 4 , secret, option) ,
284
+ ( 5 , quantity, option) ,
263
285
( 6 , offer_id, required) ,
264
- ( 1 , payer_note, option) ,
265
286
} ,
266
287
( 8 , Spontaneous ) => {
267
288
( 0 , hash, required) ,
268
289
( 2 , preimage, option) ,
269
290
} ,
270
291
( 10 , Bolt12Refund ) => {
271
292
( 0 , hash, option) ,
293
+ ( 1 , payer_note, option) ,
272
294
( 2 , preimage, option) ,
295
+ ( 3 , payer_id, option) ,
273
296
( 4 , secret, option) ,
274
- ( 1 , payer_note , option) ,
297
+ ( 5 , quantity , option) ,
275
298
} ;
276
299
) ;
277
300
0 commit comments