up
This commit is contained in:
parent
aa6923be3e
commit
113a3be9c9
2 changed files with 1 additions and 6 deletions
|
|
@ -153,22 +153,18 @@ export class LiquidityManager {
|
|||
shouldOpenChannel = async (): Promise<{ shouldOpen: false } | { shouldOpen: true, maxSpendable: number }> => {
|
||||
const threshold = this.settings.lspSettings.channelThreshold
|
||||
if (threshold === 0) {
|
||||
this.log("channel threshold is 0")
|
||||
return { shouldOpen: false }
|
||||
}
|
||||
const { remote } = await this.lnd.ChannelBalance()
|
||||
if (remote > threshold) {
|
||||
this.log("remote channel balance is already more than threshold")
|
||||
return { shouldOpen: false }
|
||||
}
|
||||
const pendingChannels = await this.lnd.ListPendingChannels()
|
||||
if (pendingChannels.pendingOpenChannels.length > 0) {
|
||||
this.log("pending open channels detected, liquidiity might be on the way")
|
||||
return { shouldOpen: false }
|
||||
}
|
||||
const maxW = await this.liquidityProvider.GetLatestMaxWithdrawable()
|
||||
if (maxW < threshold) {
|
||||
this.log("max withdrawable of", maxW, "is lower than channel threshold of", threshold)
|
||||
return { shouldOpen: false }
|
||||
}
|
||||
return { shouldOpen: true, maxSpendable: maxW }
|
||||
|
|
@ -188,7 +184,7 @@ export class LiquidityManager {
|
|||
return
|
||||
}
|
||||
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)
|
||||
if (olympusOk) {
|
||||
this.log("requested channel from olympus")
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ export class LiquidityProvider {
|
|||
this.queue.forEach(q => q('ready'))
|
||||
this.log("subbing to user operations")
|
||||
this.client.GetLiveUserOperations(res => {
|
||||
console.log("got user operation", res)
|
||||
if (res.status === 'ERROR') {
|
||||
this.log("error getting user operations", res.reason)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue