Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 4ff8021

Browse files
committed
wait for wallet sync and relax polling in the tests a bit
1 parent 0763f3c commit 4ff8021

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/test/groovy/cash/ird/walletd/IridiumClientTest.groovy

+7-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class IridiumClientTest extends Specification {
4141

4242
void setup() {
4343
wallet2 = sut2.createAddress()
44+
45+
def status = sut.getStatus()
46+
waitForBlockHeightTotal(sut2, status.getBlockCount().toInteger())
4447
}
4548

4649
void cleanupSpec() {
@@ -536,14 +539,14 @@ class IridiumClientTest extends Specification {
536539
private static void waitForBalance(IridiumAPI api, String address, long threshold) {
537540
while (api.getBalance(address).availableBalance < threshold) {
538541
log.info("Waiting for valid balance >=$threshold on wallet $address...")
539-
sleep(1000)
542+
sleep(5000)
540543
}
541544
}
542545

543546
private static void waitForTransactionConfirmation(IridiumAPI api, String transactionHash) {
544547
while (api.getUnconfirmedTransactionHashes().contains(transactionHash)) {
545548
log.info("Waiting for tx $transactionHash to get confirmed...")
546-
sleep(1000)
549+
sleep(5000)
547550
}
548551
}
549552

@@ -552,15 +555,15 @@ class IridiumClientTest extends Specification {
552555
def currentHeight
553556
while ((currentHeight = api.getStatus().knownBlockCount) && currentHeight < desiredHeight) {
554557
log.info("Waiting for blockHeight>$desiredHeight, current blockHeight=$currentHeight...")
555-
sleep(1000)
558+
sleep(5000)
556559
}
557560
}
558561

559562
private static void waitForBlockHeightTotal(IridiumAPI api, int desiredHeight) {
560563
def currentHeight
561564
while ((currentHeight = api.getStatus().knownBlockCount) && currentHeight < desiredHeight) {
562565
log.info("Waiting for blockHeight>$desiredHeight, current blockHeight=$currentHeight...")
563-
sleep(1000)
566+
sleep(5000)
564567
}
565568
}
566569

0 commit comments

Comments
 (0)