This commit is contained in:
boufni95 2025-04-16 17:34:50 +00:00
parent 1e27823ce9
commit b42af40a7f
3 changed files with 9 additions and 9 deletions

View file

@ -114,7 +114,7 @@ export default class {
NewBlockHandler = async (height: number) => {
let confirmed: (PendingTx & { confs: number; })[]
let log = getLogger({})
log("checking new block", height)
try {
const balanceEvents = await this.paymentManager.GetLndBalance()
await this.metricsManager.NewBlockCb(height, balanceEvents)

View file

@ -2,7 +2,7 @@ import { defaultInvoiceExpiry } from '../services/storage/paymentStorage.js'
import { Describe, expect, expectThrowsAsync, runSanityCheck, safelySetUserBalance, TestBase } from './testBase.js'
import * as Types from '../../proto/autogenerated/ts/types.js'
export const ignore = false
export const dev = false
export const dev = true
export default async (T: TestBase) => {
await safelySetUserBalance(T, T.user1, 2000)
await testSuccessfulExternalPayment(T)
@ -58,8 +58,8 @@ const testSuccesfulReceivedExternalChainPayment = async (T: TestBase) => {
const payment = await T.externalAccessToOtherLnd.PayAddress(user2Address.address, 1000, 3, "test", { from: 'system', useProvider: false })
expect(payment.txid).to.not.be.undefined
T.d("paid 1000 sats to user2's external chain address")
await T.chainTools.mine(2)
T.d("mined 2 blocks to confirm the payment")
await T.chainTools.mine(1)
T.d("mined 1 blocks to confirm the payment")
const u2 = await T.main.storage.userStorage.GetUser(T.user2.userId)
expect(u2.balance_sats).to.be.equal(1000)
T.d("user2 balance is now 1000")

View file

@ -30,7 +30,7 @@ export type TestBase = {
app: AppData
user1: TestUserData
user2: TestUserData
externalAccessToMainLnd: LND
//externalAccessToMainLnd: LND
externalAccessToOtherLnd: LND
externalAccessToThirdLnd: LND
adminManager: AdminManager
@ -74,8 +74,8 @@ export const SetupTest = async (d: Describe, chainTools: ChainTools): Promise<Te
const user2 = { userId: u2.info.userId, appUserIdentifier: u2.identifier, appId: app.appId }
const extermnalUtils = new Utils({ dataDir: settings.storageSettings.dataDir, allowResetMetricsStorages: settings.allowResetMetricsStorages })
const externalAccessToMainLnd = new LND(settings.lndSettings, new LiquidityProvider("", extermnalUtils, async () => { }, async () => { }), extermnalUtils, async () => { }, async () => { }, () => { }, () => { })
await externalAccessToMainLnd.Warmup()
/* const externalAccessToMainLnd = new LND(settings.lndSettings, new LiquidityProvider("", extermnalUtils, async () => { }, async () => { }), extermnalUtils, async () => { }, async () => { }, () => { }, () => { })
await externalAccessToMainLnd.Warmup() */
const otherLndSetting = { ...settings.lndSettings, mainNode: settings.lndSettings.otherNode }
const externalAccessToOtherLnd = new LND(otherLndSetting, new LiquidityProvider("", extermnalUtils, async () => { }, async () => { }), extermnalUtils, async () => { }, async () => { }, () => { }, () => { })
@ -89,7 +89,7 @@ export const SetupTest = async (d: Describe, chainTools: ChainTools): Promise<Te
return {
expect, main, app,
user1, user2,
externalAccessToMainLnd, externalAccessToOtherLnd, externalAccessToThirdLnd,
/* externalAccessToMainLnd, */ externalAccessToOtherLnd, externalAccessToThirdLnd,
d,
adminManager: initialized.adminManager,
chainTools
@ -98,7 +98,7 @@ export const SetupTest = async (d: Describe, chainTools: ChainTools): Promise<Te
export const teardown = async (T: TestBase) => {
T.main.Stop()
T.externalAccessToMainLnd.Stop()
/* T.externalAccessToMainLnd.Stop() */
T.externalAccessToOtherLnd.Stop()
T.externalAccessToThirdLnd.Stop()
T.adminManager.Stop()