Skip to content

Commit

Permalink
Merge pull request #757 from AntelopeIO/performance_harness_resolve_d…
Browse files Browse the repository at this point in the history
…uplicate_transaction_ids

[PH] Resolve Duplicate Transaction ID Generation in Transaction Generator
  • Loading branch information
ClaytonCalabrese authored Feb 28, 2023
2 parents 93f7a50 + 6dfb66e commit 62126c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,18 +518,18 @@ def checkBlockForTransactions(self, transIds, blockNum):
return transIds

def waitForTransactionsInBlockRange(self, transIds, startBlock=2, maxFutureBlocks=0):
lastBlockProcessed = startBlock
overallFinalBlock = startBlock + maxFutureBlocks
nextBlockToProcess = startBlock
overallEndBlock = startBlock + maxFutureBlocks
while len(transIds) > 0:
currentLoopEndBlock = self.getHeadBlockNum()
if currentLoopEndBlock > overallFinalBlock:
currentLoopEndBlock = overallFinalBlock
for blockNum in range(currentLoopEndBlock, lastBlockProcessed - 1, -1):
if currentLoopEndBlock > overallEndBlock:
currentLoopEndBlock = overallEndBlock
for blockNum in range(nextBlockToProcess, currentLoopEndBlock + 1):
transIds = self.checkBlockForTransactions(transIds, blockNum)
if len(transIds) == 0:
return transIds
lastBlockProcessed = currentLoopEndBlock
if currentLoopEndBlock == overallFinalBlock:
nextBlockToProcess = currentLoopEndBlock + 1
if currentLoopEndBlock == overallEndBlock:
Utils.Print("ERROR: Transactions were missing upon expiration of waitOnblockTransactions")
break
self.waitForHeadToAdvance()
Expand Down
2 changes: 1 addition & 1 deletion tests/trx_generator/trx_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace eosio::testing {
trx.actions.emplace_back(std::move(act));
}
trx.context_free_actions.emplace_back(action({}, config::null_account_name, name("nonce"),
fc::raw::pack(std::to_string(nonce_prefix) + ":" + std::to_string(++nonce) + ":" +
fc::raw::pack(std::to_string(_generator_id) + ":" + std::to_string(nonce_prefix) + ":" + std::to_string(++nonce) + ":" +
fc::time_point::now().time_since_epoch().count())));

trx.sign(priv_key, chain_id);
Expand Down

0 comments on commit 62126c6

Please sign in to comment.