@ -30,14 +30,17 @@ private:
std : : string strRejectReason ;
std : : string strRejectReason ;
unsigned int chRejectCode ;
unsigned int chRejectCode ;
bool corruptionPossible ;
bool corruptionPossible ;
std : : string strDebugMessage ;
public :
public :
CValidationState ( ) : mode ( MODE_VALID ) , nDoS ( 0 ) , chRejectCode ( 0 ) , corruptionPossible ( false ) { }
CValidationState ( ) : mode ( MODE_VALID ) , nDoS ( 0 ) , chRejectCode ( 0 ) , corruptionPossible ( false ) { }
bool DoS ( int level , bool ret = false ,
bool DoS ( int level , bool ret = false ,
unsigned int chRejectCodeIn = 0 , std : : string strRejectReasonIn = " " ,
unsigned int chRejectCodeIn = 0 , const std : : string & strRejectReasonIn = " " ,
bool corruptionIn = false ) {
bool corruptionIn = false ,
const std : : string & strDebugMessageIn = " " ) {
chRejectCode = chRejectCodeIn ;
chRejectCode = chRejectCodeIn ;
strRejectReason = strRejectReasonIn ;
strRejectReason = strRejectReasonIn ;
corruptionPossible = corruptionIn ;
corruptionPossible = corruptionIn ;
strDebugMessage = strDebugMessageIn ;
if ( mode = = MODE_ERROR )
if ( mode = = MODE_ERROR )
return ret ;
return ret ;
nDoS + = level ;
nDoS + = level ;
@ -45,8 +48,9 @@ public:
return ret ;
return ret ;
}
}
bool Invalid ( bool ret = false ,
bool Invalid ( bool ret = false ,
unsigned int _chRejectCode = 0 , std : : string _strRejectReason = " " ) {
unsigned int _chRejectCode = 0 , const std : : string & _strRejectReason = " " ,
return DoS ( 0 , ret , _chRejectCode , _strRejectReason ) ;
const std : : string & _strDebugMessage = " " ) {
return DoS ( 0 , ret , _chRejectCode , _strRejectReason , false , _strDebugMessage ) ;
}
}
bool Error ( const std : : string & strRejectReasonIn ) {
bool Error ( const std : : string & strRejectReasonIn ) {
if ( mode = = MODE_VALID )
if ( mode = = MODE_VALID )
@ -75,6 +79,7 @@ public:
}
}
unsigned int GetRejectCode ( ) const { return chRejectCode ; }
unsigned int GetRejectCode ( ) const { return chRejectCode ; }
std : : string GetRejectReason ( ) const { return strRejectReason ; }
std : : string GetRejectReason ( ) const { return strRejectReason ; }
std : : string GetDebugMessage ( ) const { return strDebugMessage ; }
} ;
} ;
# endif // BITCOIN_CONSENSUS_VALIDATION_H
# endif // BITCOIN_CONSENSUS_VALIDATION_H