mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 18:47:38 +01:00
Improve lnd test suite reliability (#4361)
This commit is contained in:
parent
4fc3b05ed5
commit
54c3f77f8e
1 changed files with 20 additions and 8 deletions
|
@ -106,11 +106,15 @@ class LndRpcClient(val instance: LndInstance, binaryOpt: Option[File] = None)(
|
||||||
applier: CallCredentials.MetadataApplier
|
applier: CallCredentials.MetadataApplier
|
||||||
): Unit = {
|
): Unit = {
|
||||||
appExecutor.execute(() => {
|
appExecutor.execute(() => {
|
||||||
|
// Wrap in a try, in case the macaroon hasn't been created yet.
|
||||||
|
Try {
|
||||||
val metadata = new Metadata()
|
val metadata = new Metadata()
|
||||||
val key =
|
val key =
|
||||||
Metadata.Key.of(macaroonKey, Metadata.ASCII_STRING_MARSHALLER)
|
Metadata.Key.of(macaroonKey, Metadata.ASCII_STRING_MARSHALLER)
|
||||||
metadata.put(key, instance.macaroon)
|
metadata.put(key, instance.macaroon)
|
||||||
applier(metadata)
|
applier(metadata)
|
||||||
|
}
|
||||||
|
()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +145,7 @@ class LndRpcClient(val instance: LndInstance, binaryOpt: Option[File] = None)(
|
||||||
lazy val signer: SignerClient = SignerClient(clientSettings)
|
lazy val signer: SignerClient = SignerClient(clientSettings)
|
||||||
lazy val router: RouterClient = RouterClient(clientSettings)
|
lazy val router: RouterClient = RouterClient(clientSettings)
|
||||||
lazy val invoices: InvoicesClient = InvoicesClient(clientSettings)
|
lazy val invoices: InvoicesClient = InvoicesClient(clientSettings)
|
||||||
|
lazy val stateClient: StateClient = StateClient(clientSettings)
|
||||||
|
|
||||||
def genSeed(): Future[GenSeedResponse] = {
|
def genSeed(): Future[GenSeedResponse] = {
|
||||||
logger.trace("lnd calling genseed")
|
logger.trace("lnd calling genseed")
|
||||||
|
@ -973,9 +978,16 @@ class LndRpcClient(val instance: LndInstance, binaryOpt: Option[File] = None)(
|
||||||
def isStarted: Future[Boolean] = {
|
def isStarted: Future[Boolean] = {
|
||||||
val p = Promise[Boolean]()
|
val p = Promise[Boolean]()
|
||||||
|
|
||||||
Try(getInfo.onComplete {
|
Try(stateClient.getState(GetStateRequest()).onComplete {
|
||||||
case Success(_) =>
|
case Success(state) =>
|
||||||
|
state.state match {
|
||||||
|
case WalletState.RPC_ACTIVE | WalletState.SERVER_ACTIVE =>
|
||||||
p.success(true)
|
p.success(true)
|
||||||
|
case _: WalletState.Unrecognized |
|
||||||
|
WalletState.WAITING_TO_START | WalletState.UNLOCKED |
|
||||||
|
WalletState.LOCKED | WalletState.NON_EXISTING =>
|
||||||
|
p.success(false)
|
||||||
|
}
|
||||||
case Failure(_) =>
|
case Failure(_) =>
|
||||||
p.success(false)
|
p.success(false)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue