@@ -102,19 +102,18 @@ impl Bolt11Payment {
102
102
let amt_msat = invoice. amount_milli_satoshis ( ) . unwrap ( ) ;
103
103
log_info ! ( self . logger, "Initiated sending {}msat to {}" , amt_msat, payee_pubkey) ;
104
104
105
- let kind = PaymentKind :: Bolt11 {
106
- hash : payment_hash,
107
- preimage : None ,
108
- secret : payment_secret,
109
- } ;
110
-
111
105
let payment = PaymentDetails {
112
106
id : payment_id,
113
- kind,
107
+ kind : PaymentKind :: Bolt11 {
108
+ hash : payment_hash,
109
+ preimage : None ,
110
+ secret : payment_secret,
111
+ } ,
114
112
amount_msat : invoice. amount_milli_satoshis ( ) ,
115
113
direction : PaymentDirection :: Outbound ,
116
114
status : PaymentStatus :: Pending ,
117
115
} ;
116
+
118
117
self . payment_store . insert ( payment) ?;
119
118
120
119
Ok ( payment_id)
@@ -124,14 +123,13 @@ impl Bolt11Payment {
124
123
match e {
125
124
RetryableSendFailure :: DuplicatePayment => Err ( Error :: DuplicatePayment ) ,
126
125
_ => {
127
- let kind = PaymentKind :: Bolt11 {
128
- hash : payment_hash,
129
- preimage : None ,
130
- secret : payment_secret,
131
- } ;
132
126
let payment = PaymentDetails {
133
127
id : payment_id,
134
- kind,
128
+ kind : PaymentKind :: Bolt11 {
129
+ hash : payment_hash,
130
+ preimage : None ,
131
+ secret : payment_secret,
132
+ } ,
135
133
amount_msat : invoice. amount_milli_satoshis ( ) ,
136
134
direction : PaymentDirection :: Outbound ,
137
135
status : PaymentStatus :: Failed ,
@@ -215,15 +213,13 @@ impl Bolt11Payment {
215
213
payee_pubkey
216
214
) ;
217
215
218
- let kind = PaymentKind :: Bolt11 {
219
- hash : payment_hash,
220
- preimage : None ,
221
- secret : Some ( * payment_secret) ,
222
- } ;
223
-
224
216
let payment = PaymentDetails {
225
217
id : payment_id,
226
- kind,
218
+ kind : PaymentKind :: Bolt11 {
219
+ hash : payment_hash,
220
+ preimage : None ,
221
+ secret : Some ( * payment_secret) ,
222
+ } ,
227
223
amount_msat : Some ( amount_msat) ,
228
224
direction : PaymentDirection :: Outbound ,
229
225
status : PaymentStatus :: Pending ,
@@ -238,15 +234,13 @@ impl Bolt11Payment {
238
234
match e {
239
235
RetryableSendFailure :: DuplicatePayment => Err ( Error :: DuplicatePayment ) ,
240
236
_ => {
241
- let kind = PaymentKind :: Bolt11 {
242
- hash : payment_hash,
243
- preimage : None ,
244
- secret : Some ( * payment_secret) ,
245
- } ;
246
-
247
237
let payment = PaymentDetails {
248
238
id : payment_id,
249
- kind,
239
+ kind : PaymentKind :: Bolt11 {
240
+ hash : payment_hash,
241
+ preimage : None ,
242
+ secret : Some ( * payment_secret) ,
243
+ } ,
250
244
amount_msat : Some ( amount_msat) ,
251
245
direction : PaymentDirection :: Outbound ,
252
246
status : PaymentStatus :: Failed ,
@@ -303,15 +297,14 @@ impl Bolt11Payment {
303
297
304
298
let payment_hash = PaymentHash ( invoice. payment_hash ( ) . to_byte_array ( ) ) ;
305
299
let id = PaymentId ( payment_hash. 0 ) ;
306
- let kind = PaymentKind :: Bolt11 {
307
- hash : payment_hash,
308
- preimage : None ,
309
- secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
310
- } ;
311
-
312
300
let payment = PaymentDetails {
313
301
id,
314
- kind,
302
+ kind : PaymentKind :: Bolt11 {
303
+ hash : payment_hash,
304
+ preimage : None ,
305
+ secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
306
+ } ,
307
+
315
308
amount_msat,
316
309
direction : PaymentDirection :: Inbound ,
317
310
status : PaymentStatus :: Pending ,
@@ -434,15 +427,14 @@ impl Bolt11Payment {
434
427
max_proportional_opening_fee_ppm_msat : lsp_prop_opening_fee,
435
428
} ;
436
429
let id = PaymentId ( payment_hash. 0 ) ;
437
- let kind = PaymentKind :: Bolt11Jit {
438
- hash : payment_hash,
439
- preimage : None ,
440
- secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
441
- lsp_fee_limits,
442
- } ;
443
430
let payment = PaymentDetails {
444
431
id,
445
- kind,
432
+ kind : PaymentKind :: Bolt11Jit {
433
+ hash : payment_hash,
434
+ preimage : None ,
435
+ secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
436
+ lsp_fee_limits,
437
+ } ,
446
438
amount_msat,
447
439
direction : PaymentDirection :: Inbound ,
448
440
status : PaymentStatus :: Pending ,
0 commit comments