From 54d738a7c12ea30d252d7151489c8992d87594d6 Mon Sep 17 00:00:00 2001 From: Lukas Lukac Date: Sun, 6 Jun 2021 12:04:40 +0200 Subject: [PATCH] Fixes race condition in TestNode_MiningSpamTransactions. --- node/node_integration_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node/node_integration_test.go b/node/node_integration_test.go index 54d60b0..891c7ec 100644 --- a/node/node_integration_test.go +++ b/node/node_integration_test.go @@ -571,13 +571,13 @@ func TestNode_MiningSpamTransactions(t *testing.T) { // Wait for the node to run and initialize its state and other components time.Sleep(time.Second) + now := uint64(time.Now().Unix()) // Schedule 4 transfers from Andrej -> BabaYaga for i := uint(1); i <= txCount; i++ { - // Ensure every TX has a unique timestamp - time.Sleep(time.Second) - txNonce := i tx := database.NewTx(andrej, babaYaga, txValue, txNonce, "") + // Ensure every TX has a unique timestamp and the nonce 0 has oldest timestamp, nonce 1 younger timestamp etc + tx.Time = now - uint64(txCount-i*100) signedTx, err := wallet.SignTxWithKeystoreAccount(tx, andrej, testKsAccountsPwd, wallet.GetKeystoreDirPath(dataDir)) if err != nil {