This commit is contained in:
boufni95 2024-07-13 20:28:07 +02:00
parent aa6923be3e
commit 113a3be9c9
2 changed files with 1 additions and 6 deletions

View file

@ -153,22 +153,18 @@ export class LiquidityManager {
shouldOpenChannel = async (): Promise<{ shouldOpen: false } | { shouldOpen: true, maxSpendable: number }> => { shouldOpenChannel = async (): Promise<{ shouldOpen: false } | { shouldOpen: true, maxSpendable: number }> => {
const threshold = this.settings.lspSettings.channelThreshold const threshold = this.settings.lspSettings.channelThreshold
if (threshold === 0) { if (threshold === 0) {
this.log("channel threshold is 0")
return { shouldOpen: false } return { shouldOpen: false }
} }
const { remote } = await this.lnd.ChannelBalance() const { remote } = await this.lnd.ChannelBalance()
if (remote > threshold) { if (remote > threshold) {
this.log("remote channel balance is already more than threshold")
return { shouldOpen: false } return { shouldOpen: false }
} }
const pendingChannels = await this.lnd.ListPendingChannels() const pendingChannels = await this.lnd.ListPendingChannels()
if (pendingChannels.pendingOpenChannels.length > 0) { if (pendingChannels.pendingOpenChannels.length > 0) {
this.log("pending open channels detected, liquidiity might be on the way")
return { shouldOpen: false } return { shouldOpen: false }
} }
const maxW = await this.liquidityProvider.GetLatestMaxWithdrawable() const maxW = await this.liquidityProvider.GetLatestMaxWithdrawable()
if (maxW < threshold) { if (maxW < threshold) {
this.log("max withdrawable of", maxW, "is lower than channel threshold of", threshold)
return { shouldOpen: false } return { shouldOpen: false }
} }
return { shouldOpen: true, maxSpendable: maxW } return { shouldOpen: true, maxSpendable: maxW }
@ -188,7 +184,7 @@ export class LiquidityManager {
return return
} }
this.channelRequesting = true this.channelRequesting = true
this.log("checking if channel should be requested") this.log("requesting channel from lsp")
const olympusOk = await this.olympusLSP.requestChannel(shouldOpen.maxSpendable) const olympusOk = await this.olympusLSP.requestChannel(shouldOpen.maxSpendable)
if (olympusOk) { if (olympusOk) {
this.log("requested channel from olympus") this.log("requested channel from olympus")

View file

@ -88,7 +88,6 @@ export class LiquidityProvider {
this.queue.forEach(q => q('ready')) this.queue.forEach(q => q('ready'))
this.log("subbing to user operations") this.log("subbing to user operations")
this.client.GetLiveUserOperations(res => { this.client.GetLiveUserOperations(res => {
console.log("got user operation", res)
if (res.status === 'ERROR') { if (res.status === 'ERROR') {
this.log("error getting user operations", res.reason) this.log("error getting user operations", res.reason)
return return