diff --git a/core/txpool/legacypool/legacypool_test.go b/core/txpool/legacypool/legacypool_test.go index 3dc11a8e09..6e6fd1ec5f 100644 --- a/core/txpool/legacypool/legacypool_test.go +++ b/core/txpool/legacypool/legacypool_test.go @@ -1273,16 +1273,15 @@ func sizedDataTransaction(t *testing.T, targetSize, nonce, gasLimit uint64, key for dataLength > 0 { txWithData := types.NewTransaction(nonce, common.Address{}, big.NewInt(0), gasLimit, gasPrice, data) signedTx, err := types.SignTx(txWithData, types.HomesteadSigner{}, key) - if txSignatureLen(signedTx) != targetSignatureLength { + switch { + case err != nil: + require.NoError(t, err, "signing transaction") + case txSignatureLen(signedTx) != targetSignatureLength: // try again with other data to get a signature of the desired length for i := range data { data[i]++ } continue - } - switch { - case err != nil: - require.NoError(t, err, "signing transaction") case signedTx.Size() == targetSize: return signedTx case signedTx.Size() < targetSize: