From e46a6386dfe4848885182f8cb089638105c80598 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 9 Sep 2022 12:29:54 -0500 Subject: [PATCH] GH-127 Verify on the correct fork before verifying trx status --- tests/trx_finality_status_forked_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/trx_finality_status_forked_test.py b/tests/trx_finality_status_forked_test.py index 4063539d41..5e2b218f17 100755 --- a/tests/trx_finality_status_forked_test.py +++ b/tests/trx_finality_status_forked_test.py @@ -240,6 +240,7 @@ def getState(status): f"\n\nprod 0 info: {json.dumps(prodNodes[0].getInfo(), indent=1)}\n\nprod 1 info: {json.dumps(prodNodes[1].getInfo(), indent=1)}" afterForkInBlockState = retStatus + afterForkBlockId = retStatus["block_id"] assert afterForkInBlockState["block_number"] > originalInBlockState["block_number"], \ "ERROR: The way the test is designed, the transaction should be added to a block that has a higher number than it was in originally before it was forked out." + \ f"\n\noriginal in block state: {json.dumps(originalInBlockState, indent=1)}\n\nafter fork in block state: {json.dumps(afterForkInBlockState, indent=1)}" @@ -248,6 +249,12 @@ def getState(status): f"ERROR: Block never finalized.\n\nprod 0 info: {json.dumps(prodNodes[0].getInfo(), indent=1)}\n\nprod 1 info: {json.dumps(prodNodes[1].getInfo(), indent=1)}" + \ f"\n\nafter fork in block state: {json.dumps(afterForkInBlockState, indent=1)}" + retStatus = prodNodes[1].getTransactionStatus(transId) + if afterForkBlockId != retStatus["block_id"]: # might have been forked out, if so wait for new block to become LIB + assert prodNodes[1].waitForBlock(retStatus["block_number"], blockType=BlockType.lib), \ + f"ERROR: Block never finalized.\n\nprod 0 info: {json.dumps(prodNodes[0].getInfo(), indent=1)}\n\nprod 1 info: {json.dumps(prodNodes[1].getInfo(), indent=1)}" + \ + f"\n\nafter fork in block state: {json.dumps(afterForkInBlockState, indent=1)}" + retStatus = prodNodes[1].getTransactionStatus(transId) state = getState(retStatus)