mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-13 19:37:30 +01:00
* fix monitor invoice timing out in #693 * Bump timeout more
This commit is contained in:
parent
227b5239e5
commit
62e959950b
2 changed files with 19 additions and 9 deletions
|
@ -7,7 +7,11 @@ import org.bitcoins.core.config.RegTest
|
|||
import org.bitcoins.core.currency.{CurrencyUnit, CurrencyUnits, Satoshis}
|
||||
import org.bitcoins.core.number.{Int64, UInt64}
|
||||
import org.bitcoins.core.protocol.ln.LnParams.LnBitcoinRegTest
|
||||
import org.bitcoins.core.protocol.ln.channel.{ChannelId, ChannelState, FundedChannelId}
|
||||
import org.bitcoins.core.protocol.ln.channel.{
|
||||
ChannelId,
|
||||
ChannelState,
|
||||
FundedChannelId
|
||||
}
|
||||
import org.bitcoins.core.protocol.ln.currency._
|
||||
import org.bitcoins.core.protocol.ln.node.NodeId
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
|
@ -25,7 +29,11 @@ import scala.concurrent.duration.DurationInt
|
|||
import org.bitcoins.testkit.rpc.BitcoindRpcTestUtil
|
||||
import akka.stream.StreamTcpException
|
||||
import org.bitcoins.core.protocol.BitcoinAddress
|
||||
import org.bitcoins.core.protocol.ln.{LnHumanReadablePart, LnInvoice, PaymentPreimage}
|
||||
import org.bitcoins.core.protocol.ln.{
|
||||
LnHumanReadablePart,
|
||||
LnInvoice,
|
||||
PaymentPreimage
|
||||
}
|
||||
import org.bitcoins.testkit.async.TestAsyncUtil
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
@ -321,11 +329,13 @@ class EclairRpcClientTest extends AsyncFlatSpec with BeforeAndAfterAll {
|
|||
val eclair = new EclairRpcClient(server)
|
||||
eclair.start().map(_ => eclair)
|
||||
}
|
||||
_ <- TestAsyncUtil.retryUntilSatisfiedF(conditionF = () => eclair.isStarted(),
|
||||
duration = 1.second,
|
||||
maxTries = 60)
|
||||
_ <- TestAsyncUtil.retryUntilSatisfiedF(conditionF =
|
||||
() => eclair.isStarted(),
|
||||
duration = 1.second,
|
||||
maxTries = 60)
|
||||
_ = EclairRpcTestUtil.shutdown(eclair)
|
||||
_ <- TestAsyncUtil.retryUntilSatisfiedF(conditionF = () => eclair.isStarted().map(!_),
|
||||
_ <- TestAsyncUtil.retryUntilSatisfiedF(
|
||||
conditionF = () => eclair.isStarted().map(!_),
|
||||
duration = 1.second,
|
||||
maxTries = 60)
|
||||
} yield succeed
|
||||
|
@ -713,11 +723,11 @@ class EclairRpcClientTest extends AsyncFlatSpec with BeforeAndAfterAll {
|
|||
val test = (client: EclairRpcClient, otherClient: EclairRpcClient) => {
|
||||
val invoiceF = otherClient.createInvoice("monitor an invoice", amt)
|
||||
val paidF = invoiceF.flatMap(i => client.payInvoice(i))
|
||||
val monitorF = invoiceF.flatMap(i => otherClient.monitorInvoice(i))
|
||||
for {
|
||||
paid <- paidF
|
||||
invoice <- invoiceF
|
||||
received <- monitorF
|
||||
//CI is super slow... wait 2 minutes
|
||||
received <- otherClient.monitorInvoice(invoice, maxAttempts = 120)
|
||||
} yield {
|
||||
assert(received.amountMsat == amt)
|
||||
assert(received.paymentHash == invoice.lnTags.paymentHash.hash)
|
||||
|
|
|
@ -373,7 +373,7 @@ class EclairRpcClient(val instance: EclairInstance)(
|
|||
//event stream,
|
||||
receivedInfoF.map {
|
||||
case None =>
|
||||
if (attempts.incrementAndGet() > maxAttempts) {
|
||||
if (attempts.incrementAndGet() >= maxAttempts) {
|
||||
// too many tries to get info about a payment
|
||||
// either Eclair is down or the payment is still in PENDING state for some reason
|
||||
// complete the promise with an exception so the runnable will be canceled
|
||||
|
|
Loading…
Add table
Reference in a new issue