Skip to content

Commit

Permalink
fix integration test - removed while loops
Browse files Browse the repository at this point in the history
Signed-off-by: Nischal Sharma <nischal@web3labs.com>
  • Loading branch information
NickSneo committed Mar 21, 2024
1 parent 1c39643 commit b85bbf1
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public static void setUpOnce() throws InterruptedException, IOException {
rpcNode = Besu.build(new HttpService("http://127.0.0.1:8545"));

int blockNumber = 0;
do {
for (int i = 0; i < 5 && blockNumber <= 100; i++) {
TimeUnit.SECONDS.sleep(30);
blockNumber = rpcNode.ethBlockNumber().send().getBlockNumber().intValue();
} while (blockNumber <= 100);
}
}

@AfterAll
Expand All @@ -114,11 +114,14 @@ public void testConnection() throws IOException {
public void simplePrivateTransactions() throws Exception {

// Build new privacy group using the create API
Base64String privacyGroupId;
do {
Base64String privacyGroupId = null;
for (int i = 0; i < 5; i++) {
privacyGroupId = getPrivacyGroupId();
if (privacyGroupId != null) {
break;
}
TimeUnit.SECONDS.sleep(30);
} while (privacyGroupId == null);
}

final BigInteger nonce =
nodeCharlie
Expand All @@ -140,11 +143,14 @@ public void simplePrivateTransactions() throws Exception {
PrivateTransactionEncoder.signMessage(
rawPrivateTransaction, CHAIN_ID, ALICE));

EthSendTransaction eeaTransaction;
do {
EthSendTransaction eeaTransaction = null;
for (int i = 0; i < 5; i++) {
eeaTransaction = nodeAlice.eeaSendRawTransaction(signedTransactionData).send();
if (!eeaTransaction.hasError()) {
break;
}
TimeUnit.SECONDS.sleep(30);
} while (eeaTransaction.hasError());
}

final String transactionHash = eeaTransaction.getTransactionHash();
final PollingPrivateTransactionReceiptProcessor receiptProcessor =
Expand Down

0 comments on commit b85bbf1

Please sign in to comment.