@@ -102,19 +102,18 @@ impl Bolt11Payment {
102102 let amt_msat = invoice. amount_milli_satoshis ( ) . unwrap ( ) ;
103103 log_info ! ( self . logger, "Initiated sending {}msat to {}" , amt_msat, payee_pubkey) ;
104104
105- let kind = PaymentKind :: Bolt11 {
106- hash : payment_hash,
107- preimage : None ,
108- secret : payment_secret,
109- } ;
110-
111105 let payment = PaymentDetails {
112106 id : payment_id,
113- kind,
107+ kind : PaymentKind :: Bolt11 {
108+ hash : payment_hash,
109+ preimage : None ,
110+ secret : payment_secret,
111+ } ,
114112 amount_msat : invoice. amount_milli_satoshis ( ) ,
115113 direction : PaymentDirection :: Outbound ,
116114 status : PaymentStatus :: Pending ,
117115 } ;
116+
118117 self . payment_store . insert ( payment) ?;
119118
120119 Ok ( payment_id)
@@ -124,14 +123,13 @@ impl Bolt11Payment {
124123 match e {
125124 RetryableSendFailure :: DuplicatePayment => Err ( Error :: DuplicatePayment ) ,
126125 _ => {
127- let kind = PaymentKind :: Bolt11 {
128- hash : payment_hash,
129- preimage : None ,
130- secret : payment_secret,
131- } ;
132126 let payment = PaymentDetails {
133127 id : payment_id,
134- kind,
128+ kind : PaymentKind :: Bolt11 {
129+ hash : payment_hash,
130+ preimage : None ,
131+ secret : payment_secret,
132+ } ,
135133 amount_msat : invoice. amount_milli_satoshis ( ) ,
136134 direction : PaymentDirection :: Outbound ,
137135 status : PaymentStatus :: Failed ,
@@ -215,15 +213,13 @@ impl Bolt11Payment {
215213 payee_pubkey
216214 ) ;
217215
218- let kind = PaymentKind :: Bolt11 {
219- hash : payment_hash,
220- preimage : None ,
221- secret : Some ( * payment_secret) ,
222- } ;
223-
224216 let payment = PaymentDetails {
225217 id : payment_id,
226- kind,
218+ kind : PaymentKind :: Bolt11 {
219+ hash : payment_hash,
220+ preimage : None ,
221+ secret : Some ( * payment_secret) ,
222+ } ,
227223 amount_msat : Some ( amount_msat) ,
228224 direction : PaymentDirection :: Outbound ,
229225 status : PaymentStatus :: Pending ,
@@ -238,15 +234,13 @@ impl Bolt11Payment {
238234 match e {
239235 RetryableSendFailure :: DuplicatePayment => Err ( Error :: DuplicatePayment ) ,
240236 _ => {
241- let kind = PaymentKind :: Bolt11 {
242- hash : payment_hash,
243- preimage : None ,
244- secret : Some ( * payment_secret) ,
245- } ;
246-
247237 let payment = PaymentDetails {
248238 id : payment_id,
249- kind,
239+ kind : PaymentKind :: Bolt11 {
240+ hash : payment_hash,
241+ preimage : None ,
242+ secret : Some ( * payment_secret) ,
243+ } ,
250244 amount_msat : Some ( amount_msat) ,
251245 direction : PaymentDirection :: Outbound ,
252246 status : PaymentStatus :: Failed ,
@@ -303,15 +297,14 @@ impl Bolt11Payment {
303297
304298 let payment_hash = PaymentHash ( invoice. payment_hash ( ) . to_byte_array ( ) ) ;
305299 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-
312300 let payment = PaymentDetails {
313301 id,
314- kind,
302+ kind : PaymentKind :: Bolt11 {
303+ hash : payment_hash,
304+ preimage : None ,
305+ secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
306+ } ,
307+
315308 amount_msat,
316309 direction : PaymentDirection :: Inbound ,
317310 status : PaymentStatus :: Pending ,
@@ -434,15 +427,14 @@ impl Bolt11Payment {
434427 max_proportional_opening_fee_ppm_msat : lsp_prop_opening_fee,
435428 } ;
436429 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- } ;
443430 let payment = PaymentDetails {
444431 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+ } ,
446438 amount_msat,
447439 direction : PaymentDirection :: Inbound ,
448440 status : PaymentStatus :: Pending ,
0 commit comments