From 0d7d2fd798196e025fbf5a6a7cc35a5012060b9d Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 6 Jul 2023 15:58:42 -0500 Subject: [PATCH] GH-1340 Code cleanup --- tests/TestHarness/Cluster.py | 2 +- tests/ship_streamer.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/TestHarness/Cluster.py b/tests/TestHarness/Cluster.py index c512f4dfe1..6606224611 100644 --- a/tests/TestHarness/Cluster.py +++ b/tests/TestHarness/Cluster.py @@ -1731,6 +1731,6 @@ def waitForTrxGeneratorsSpinup(self, nodeId: int, numGenerators: int, timeout: i firstTrxs.append(line.rstrip('\n')) Utils.Print(f"first transactions: {firstTrxs}") status = node.waitForTransactionsInBlock(firstTrxs) - if status is None or status is False: + if not status: Utils.Print('ERROR: Failed to spin up transaction generators: never received first transactions') return status diff --git a/tests/ship_streamer.cpp b/tests/ship_streamer.cpp index 8ce32f096f..94a3c40fc9 100644 --- a/tests/ship_streamer.cpp +++ b/tests/ship_streamer.cpp @@ -154,17 +154,19 @@ int main(int argc, char* argv[]) { // validate after streaming, so that invalid entry is included in the output uint32_t this_block_num = 0; if( result_document[1].HasMember("this_block") && result_document[1]["this_block"].IsObject() ) { - if( result_document[1]["this_block"].HasMember("block_num") && result_document[1]["this_block"]["block_num"].IsUint() ) { - this_block_num = result_document[1]["this_block"]["block_num"].GetUint(); + const auto& this_block = result_document[1]["this_block"]; + if( this_block.HasMember("block_num") && this_block["block_num"].IsUint() ) { + this_block_num = this_block["block_num"].GetUint(); } std::string this_block_id; - if( result_document[1]["this_block"].HasMember("block_id") && result_document[1]["this_block"]["block_id"].IsString() ) { - this_block_id = result_document[1]["this_block"]["block_id"].GetString(); + if( this_block.HasMember("block_id") && this_block["block_id"].IsString() ) { + this_block_id = this_block["block_id"].GetString(); } std::string prev_block_id; if( result_document[1].HasMember("prev_block") && result_document[1]["prev_block"].IsObject() ) { - if ( result_document[1]["prev_block"].HasMember("block_id") && result_document[1]["prev_block"]["block_id"].IsString() ) { - prev_block_id = result_document[1]["prev_block"]["block_id"].GetString(); + const auto& prev_block = result_document[1]["prev_block"]; + if ( prev_block.HasMember("block_id") && prev_block["block_id"].IsString() ) { + prev_block_id = prev_block["block_id"].GetString(); } } if( !irreversible_only && !this_block_id.empty() && !prev_block_id.empty() ) {