Fix TypeError on item creation if JIT invoicing is used (#744)
* Fix TypeError on item creation if JIT invoicing is used * Fix bad if body --------- Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
		
							parent
							
								
									c267bf92fd
								
							
						
					
					
						commit
						39c9775c4c
					
				@ -85,8 +85,9 @@ export async function serializeInvoicable (query, { models, lnd, hash, hmac, me,
 | 
			
		||||
  let results = await serialize(models, ...trx)
 | 
			
		||||
 | 
			
		||||
  if (hash) {
 | 
			
		||||
    if (invoice?.isHeld) await settleHodlInvoice({ secret: invoice.preimage, lnd })
 | 
			
		||||
    results = results.slice(1, -1)
 | 
			
		||||
    if (invoice?.isHeld) { await settleHodlInvoice({ secret: invoice.preimage, lnd }) }
 | 
			
		||||
    // remove first element since that is the confirmed invoice
 | 
			
		||||
    [, ...results] = results
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // if there is only one result, return it directly, else the array
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user