Skip to content

Commit

Permalink
GH-1340 Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jul 6, 2023
1 parent 6c14f56 commit 0d7d2fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 8 additions & 6 deletions tests/ship_streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down

0 comments on commit 0d7d2fd

Please sign in to comment.