mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 10:46:42 +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
|
||||
): Unit = {
|
||||
appExecutor.execute(() => {
|
||||
val metadata = new Metadata()
|
||||
val key =
|
||||
Metadata.Key.of(macaroonKey, Metadata.ASCII_STRING_MARSHALLER)
|
||||
metadata.put(key, instance.macaroon)
|
||||
applier(metadata)
|
||||
// Wrap in a try, in case the macaroon hasn't been created yet.
|
||||
Try {
|
||||
val metadata = new Metadata()
|
||||
val key =
|
||||
Metadata.Key.of(macaroonKey, Metadata.ASCII_STRING_MARSHALLER)
|
||||
metadata.put(key, instance.macaroon)
|
||||
applier(metadata)
|
||||
}
|
||||
()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -141,6 +145,7 @@ class LndRpcClient(val instance: LndInstance, binaryOpt: Option[File] = None)(
|
|||
lazy val signer: SignerClient = SignerClient(clientSettings)
|
||||
lazy val router: RouterClient = RouterClient(clientSettings)
|
||||
lazy val invoices: InvoicesClient = InvoicesClient(clientSettings)
|
||||
lazy val stateClient: StateClient = StateClient(clientSettings)
|
||||
|
||||
def genSeed(): Future[GenSeedResponse] = {
|
||||
logger.trace("lnd calling genseed")
|
||||
|
@ -973,9 +978,16 @@ class LndRpcClient(val instance: LndInstance, binaryOpt: Option[File] = None)(
|
|||
def isStarted: Future[Boolean] = {
|
||||
val p = Promise[Boolean]()
|
||||
|
||||
Try(getInfo.onComplete {
|
||||
case Success(_) =>
|
||||
p.success(true)
|
||||
Try(stateClient.getState(GetStateRequest()).onComplete {
|
||||
case Success(state) =>
|
||||
state.state match {
|
||||
case WalletState.RPC_ACTIVE | WalletState.SERVER_ACTIVE =>
|
||||
p.success(true)
|
||||
case _: WalletState.Unrecognized |
|
||||
WalletState.WAITING_TO_START | WalletState.UNLOCKED |
|
||||
WalletState.LOCKED | WalletState.NON_EXISTING =>
|
||||
p.success(false)
|
||||
}
|
||||
case Failure(_) =>
|
||||
p.success(false)
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue