FIX: clear balance cache when user's invoice was paid (closes #85)
This commit is contained in:
		
							parent
							
								
									ac14a50137
								
							
						
					
					
						commit
						17bdf37f9b
					
				@ -72,6 +72,9 @@ subscribeInvoicesCall.on('data', async function (response) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    let invoice = new Invo(redis, bitcoinclient, lightning);
 | 
					    let invoice = new Invo(redis, bitcoinclient, lightning);
 | 
				
			||||||
    await invoice._setIsPaymentHashPaidInDatabase(LightningInvoiceSettledNotification.hash, true);
 | 
					    await invoice._setIsPaymentHashPaidInDatabase(LightningInvoiceSettledNotification.hash, true);
 | 
				
			||||||
 | 
					    const user = new User(redis, bitcoinclient, lightning);
 | 
				
			||||||
 | 
					    user._userid = await user.getUseridByPaymentHash(LightningInvoiceSettledNotification.hash);
 | 
				
			||||||
 | 
					    await user.clearBalanceCache();
 | 
				
			||||||
    console.log('payment', LightningInvoiceSettledNotification.hash, 'was paid, posting to GroundControl...');
 | 
					    console.log('payment', LightningInvoiceSettledNotification.hash, 'was paid, posting to GroundControl...');
 | 
				
			||||||
    const baseURI = process.env.GROUNDCONTROL;
 | 
					    const baseURI = process.env.GROUNDCONTROL;
 | 
				
			||||||
    if (!baseURI) return;
 | 
					    if (!baseURI) return;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user