Add listPendingChannels to LND (#4603)

This commit is contained in:
benthecarman 2022-08-12 06:23:04 -05:00 committed by GitHub
parent e413f04106
commit 64bc1367c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -76,7 +76,21 @@ class LndRpcClientPairTest extends DualLndFixture {
pushAmt = Satoshis(10),
satPerVByte = SatoshisPerVirtualByte.one,
privateChannel = false)
} yield assert(outpointOpt.isDefined)
pendingA <- lndA.listPendingChannels()
pendingB <- lndB.listPendingChannels()
} yield {
assert(outpointOpt.isDefined)
val outpoint = outpointOpt.get
val expectedOutpoint = s"${outpoint.txId.hex}:${outpoint.vout.toInt}"
assert(
pendingA.pendingOpenChannels.exists(
_.channel.get.channelPoint == expectedOutpoint))
assert(
pendingB.pendingOpenChannels.exists(
_.channel.get.channelPoint == expectedOutpoint))
}
}
it must "close a channel" in { param =>

View File

@ -509,6 +509,12 @@ class LndRpcClient(val instance: LndInstance, binaryOpt: Option[File] = None)(
.map(_.channels.toVector)
}
def listPendingChannels(): Future[PendingChannelsResponse] = {
logger.trace("lnd calling pendingchannels")
lnd.pendingChannels(PendingChannelsRequest())
}
def findChannel(
channelPoint: TransactionOutPoint): Future[Option[Channel]] = {
listChannels().map { channels =>