@@ -287,7 +287,7 @@ bool DiagnosticsDialog::VerifyCPIDHasRAC()
287
287
return (racValue >= 1 ) ? true : false ;
288
288
}
289
289
290
- double VerifyETTSReasonable ()
290
+ double DiagnosticsDialog:: VerifyETTSReasonable ()
291
291
{
292
292
// We are going to compute the ETTS with ignore_staking_status set to true
293
293
// and also use a 960 block diff as the input, which smooths out short
@@ -357,6 +357,11 @@ void DiagnosticsDialog::on_testButton_clicked()
357
357
ui->verifyCPIDIsInNNResultLabel ->setText (tr (" N/A" ));
358
358
ui->verifyCPIDIsInNNResultLabel ->setStyleSheet (" color:black;background-color:grey" );
359
359
UpdateTestStatus (" verifyCPIDIsInNN" , completed);
360
+
361
+ ui->checkETTSResultLabel ->setText (tr (" N/A" ));
362
+ ui->checkETTSResultLabel ->setStyleSheet (" color:black;background-color:grey" );
363
+ UpdateTestStatus (" checkETTS" , completed);
364
+
360
365
}
361
366
else
362
367
{
@@ -444,6 +449,57 @@ void DiagnosticsDialog::on_testButton_clicked()
444
449
UpdateTestStatus (" verifyCPIDIsInNN" , completed);
445
450
UpdateOverallDiagnosticResult (failed);
446
451
}
452
+
453
+ // verify reasonable ETTS
454
+ // This is only checked if wallet is a researcher wallet because the purpose is to
455
+ // alert the owner that his stake time is too long and therefore there is a chance
456
+ // of research rewards loss between stakes due to the 180 day limit.
457
+ ui->checkETTSResultLabel ->setStyleSheet (" " );
458
+ ui->checkETTSResultLabel ->setText (tr (" Testing..." ));
459
+ UpdateTestStatus (" checkETTS" , pending);
460
+
461
+ double ETTS = VerifyETTSReasonable () / (24.0 * 60.0 * 60.0 );
462
+
463
+ std::string rounded_ETTS;
464
+
465
+ // round appropriately for display.
466
+ if (ETTS >= 100 )
467
+ {
468
+ rounded_ETTS = RoundToString (ETTS, 0 );
469
+ }
470
+ else if (ETTS >= 10 )
471
+ {
472
+ rounded_ETTS = RoundToString (ETTS, 1 );
473
+ }
474
+ else
475
+ {
476
+ rounded_ETTS = RoundToString (ETTS, 2 );
477
+ }
478
+
479
+ if (ETTS > 90.0 || ETTS == 0.0 )
480
+ {
481
+ ui->checkETTSResultLabel ->setText (tr (" Failed: ETTS = %1 > 90 days" )
482
+ .arg (QString (rounded_ETTS.c_str ())));
483
+ ui->checkETTSResultLabel ->setStyleSheet (" color:white;background-color:red" );
484
+ UpdateTestStatus (" checkETTS" , completed);
485
+ UpdateOverallDiagnosticResult (failed);
486
+ }
487
+ else if (ETTS > 45.0 && ETTS <= 90.0 )
488
+ {
489
+ ui->checkETTSResultLabel ->setText (tr (" Warning: 45 days < ETTS = %1 <= 90 days" )
490
+ .arg (QString (rounded_ETTS.c_str ())));
491
+ ui->checkETTSResultLabel ->setStyleSheet (" color:black;background-color:yellow" );
492
+ UpdateTestStatus (" checkETTS" , completed);
493
+ UpdateOverallDiagnosticResult (warning);
494
+ }
495
+ else
496
+ {
497
+ ui->checkETTSResultLabel ->setText (tr (" Passed: ETTS = %1 <= 45 days" )
498
+ .arg (QString (rounded_ETTS.c_str ())));
499
+ ui->checkETTSResultLabel ->setStyleSheet (" color:white;background-color:green" );
500
+ UpdateTestStatus (" checkETTS" , completed);
501
+ UpdateOverallDiagnosticResult (passed);
502
+ }
447
503
}
448
504
449
505
// Tests that are common to both investor and researcher mode.
@@ -556,36 +612,6 @@ void DiagnosticsDialog::on_testButton_clicked()
556
612
UpdateOverallDiagnosticResult (NA);
557
613
}
558
614
559
- // verify reasonable ETTS
560
- ui->checkETTSResultLabel ->setStyleSheet (" " );
561
- ui->checkETTSResultLabel ->setText (tr (" Testing..." ));
562
- UpdateTestStatus (" checkETTS" , pending);
563
- double ETTS = VerifyETTSReasonable () / (24.0 * 60.0 * 60.0 );
564
-
565
- if (ETTS > 90.0 )
566
- {
567
- ui->checkETTSResultLabel ->setText (tr (" Failed: ETTS = %1 > 90 days" ));
568
- ui->checkETTSResultLabel ->setStyleSheet (" color:white;background-color:red" );
569
- UpdateTestStatus (" checkETTS" , completed);
570
- UpdateOverallDiagnosticResult (failed);
571
- }
572
- else if (ETTS > 45.0 && ETTS <= 90.0 )
573
- {
574
- ui->checkETTSResultLabel ->setText (tr (" Warning: 45 days < ETTS = %1 <= 90 days" ));
575
- ui->checkETTSResultLabel ->setStyleSheet (" color:black;background-color:yellow" );
576
- UpdateTestStatus (" checkETTS" , completed);
577
- UpdateOverallDiagnosticResult (warning);
578
- }
579
- else
580
- {
581
- ui->checkETTSResultLabel ->setText (tr (" Passed: ETTS <= 45 days" ));
582
- ui->checkETTSResultLabel ->setStyleSheet (" color:white;background-color:green" );
583
- UpdateTestStatus (" checkETTS" , completed);
584
- UpdateOverallDiagnosticResult (passed);
585
- }
586
-
587
-
588
-
589
615
// client version
590
616
ui->checkClientVersionResultLabel ->setStyleSheet (" " );
591
617
ui->checkClientVersionResultLabel ->setText (tr (" Testing..." ));
0 commit comments