@@ -244,39 +244,53 @@ void SolverCore::gotStageThree(const cs::StageThree& stage, const uint8_t flagg)
244244
245245 auto lamda = [this ](const cs::StageThree& stageFrom, const cs::StageThree& stageTo) {
246246 const cs::Conveyer& conveyer = cs::Conveyer::instance ();
247- bool somethingInvalid = false ;
247+ bool markedUntrusted = false ;
248248 if (stageTo.realTrustedMask [stageFrom.sender ] == cs::ConfidantConsts::InvalidConfidantIndex) {
249- cswarning () << " The node, who sent this stage was marked as untrusted" ;
250- somethingInvalid = true ;
249+ markedUntrusted = true ;
251250 }
252-
251+ bool invalidBlockSignatures = false ;
253252 if (!cscrypto::verifySignature (stageFrom.blockSignature , conveyer.confidantByIndex (stageFrom.sender ), stageTo.blockHash .data (), stageTo.blockHash .size ())) {
254- cswarning () << " Block Signatures are not valid ! -> " ;
255- somethingInvalid = true ;
253+ invalidBlockSignatures = true ;
256254 }
257-
255+ bool invalidRoundSignatures = false ;
258256 if (!cscrypto::verifySignature (stageFrom.roundSignature , conveyer.confidantByIndex (stageFrom.sender ), stageTo.roundHash .data (), stageTo.roundHash .size ())) {
259- cswarning () << " Round Signatures are not valid !" ;
260- somethingInvalid = true ;
257+ invalidRoundSignatures = true ;
261258 }
262-
259+ bool invalidTrustedSignatures = false ;
263260 if (!cscrypto::verifySignature (stageFrom.trustedSignature , conveyer.confidantByIndex (stageFrom.sender ), stageTo.trustedHash .data (), stageTo.trustedHash .size ())) {
264- cswarning () << " Trusted Signatures are not valid !" ;
265- somethingInvalid = true ;
261+ invalidTrustedSignatures = true ;
266262 }
267-
263+ bool invalidRealTrustedMask = false ;
268264 if (!(stageFrom.realTrustedMask == stageTo.realTrustedMask ) || stageTo.realTrustedMask [stageFrom.sender ] == cs::ConfidantConsts::InvalidConfidantIndex) {
269- cswarning () << " Real Trusted are not valid !" ;
270- somethingInvalid = true ;
265+ bool invalidRealTrustedMask = false ;
271266 }
272-
267+ bool invalidWriter = false ;
273268 if (!(stageFrom.writer == stageTo.writer )) {
274- cswarning () << " Writer is not valid !" ;
275- somethingInvalid = true ;
269+ invalidWriter = true ;
276270 }
277271
278- if (somethingInvalid) {
272+ if (markedUntrusted || invalidBlockSignatures || invalidRoundSignatures || invalidTrustedSignatures || invalidRealTrustedMask || invalidWriter){
273+ cswarning () << " Stage3 from T[" << static_cast <int >(stageFrom.sender ) << " ] - final check ... NOT PASSED! This problem will be resolved automatically." ;
274+ csdebug () << " The stage below has next problems:" ;
275+ if (markedUntrusted) {
276+ csdebug () << " --> The node, that sent this stage was marked as untrusted" ;
277+ }
279278 if (stageTo.realTrustedMask [stageFrom.sender ] != cs::ConfidantConsts::InvalidConfidantIndex) {
279+ if (invalidBlockSignatures) {
280+ csdebug () << " --> Block Signatures are not valid" ;
281+ }
282+ if (invalidRoundSignatures) {
283+ csdebug () << " --> Round Signatures are not valid." ;
284+ }
285+ if (invalidTrustedSignatures) {
286+ csdebug () << " --> Trusted Signatures are not valid." ;
287+ }
288+ if (invalidRealTrustedMask) {
289+ csdebug () << " --> Real Trusted are not valid." ;
290+ }
291+ if (invalidWriter) {
292+ csdebug () << " --> Writer is not valid." ;
293+ }
280294 csdebug () << cs::StageThree::toString (stageFrom);
281295 realTrustedSetValue (stageFrom.sender , cs::ConfidantConsts::InvalidConfidantIndex);
282296 }
@@ -288,7 +302,7 @@ void SolverCore::gotStageThree(const cs::StageThree& stage, const uint8_t flagg)
288302 // }
289303 trueStageThreeStorage.emplace_back (stageFrom);
290304 addRoundSignature (stageFrom);
291- csdebug () << " Stage3 [" << static_cast <int >(stageFrom.sender ) << " ] - signatures are OK " ;
305+ csdebug () << " Stage3 from T [" << static_cast <int >(stageFrom.sender ) << " ] - final check ... passed! " ;
292306 };
293307
294308 switch (flagg) {
@@ -332,7 +346,7 @@ void SolverCore::gotStageThree(const cs::StageThree& stage, const uint8_t flagg)
332346 handleTransitions (Event::Stage3NonComplete);
333347 break ;
334348 case Result::Failure:
335- cserror () << " SolverCore: error in state " << (pstate ? pstate->name () : " null" );
349+ cserror () << " SolverCore: error in state " << (pstate ? pstate->name () : " null - Consensus state can't be completed. Trying to resolve ... " );
336350 removeDeferredBlock (deferredBlock_.sequence ());
337351 handleTransitions (Event::SetNormal);
338352 break ;
0 commit comments