Skip to content

Commit

Permalink
806 fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex committed Apr 30, 2024
1 parent 4b545cc commit 7361cc1
Showing 1 changed file with 27 additions and 37 deletions.
64 changes: 27 additions & 37 deletions chains/Schain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ void Schain::postMessage( const ptr< MessageEnvelope >& _me ) {

CHECK_STATE( ( uint64_t ) _me->getMessage()->getBlockId() != 0 );
{
lock_guard<mutex> l(messageMutex);
messageQueue.push(_me);
lock_guard< mutex > l( messageMutex );
messageQueue.push( _me );
messageCond.notify_all();
}
}
Expand Down Expand Up @@ -242,12 +242,9 @@ Schain::Schain( weak_ptr< Node > _node, schain_index _schainIndex, const schain_
node( _node ),
schainIndex( _schainIndex ) {
lastCommittedBlockTimeStamp = TimeStamp( 0, 0 );

setTimeStampValuesFromConfig();



// construct monitoring, timeout, stuck detection, and optimizer agents early
// construct monitoring, timeout and stuck detection agents early
monitoringAgent = make_shared< MonitoringAgent >( *this );

if ( !getNode()->isSyncOnlyNode() ) {
Expand Down Expand Up @@ -307,22 +304,6 @@ Schain::Schain( weak_ptr< Node > _node, schain_index _schainIndex, const schain_
}



#define SET_TIMESTAMP_FROM_CONFIG(TIMESTAMP_NAME) \
{ \
auto& timestamps = getNode()->getPatchTimestamps(); \
if (timestamps.count(#TIMESTAMP_NAME) > 0) { \
TIMESTAMP_NAME = timestamps.at(#TIMESTAMP_NAME); \
} \
}


void Schain::setTimeStampValuesFromConfig() {
SET_TIMESTAMP_FROM_CONFIG(verifyDaSigsPatchTimestampS)
SET_TIMESTAMP_FROM_CONFIG(fastConsensusPatchTimestampS)
}


// called from constructor so no locks needed
void Schain::constructChildAgents() {
MONITOR( __CLASS_NAME__, __FUNCTION__ )
Expand Down Expand Up @@ -456,10 +437,6 @@ bool Schain::verifyDASigsPatch( uint64_t _blockTimeStampS ) {
return verifyDaSigsPatchTimestampS != 0 && _blockTimeStampS >= verifyDaSigsPatchTimestampS;
}

bool Schain::fastConsensusPatch(uint64_t _blockTimeStampS) {
return fastConsensusPatchTimestampS != 0 && _blockTimeStampS >= fastConsensusPatchTimestampS;
}


void Schain::blockCommitArrived( block_id _committedBlockID, schain_index _proposerIndex,
const ptr< ThresholdSignature >& _thresholdSig, ptr< ThresholdSignature > _daSig ) {
Expand Down Expand Up @@ -919,18 +896,11 @@ void Schain::daProofArrived( const ptr< DAProof >& _daProof ) {

MONITOR( __CLASS_NAME__, __FUNCTION__ )


try {

auto bid = _daProof->getBlockId();

if (bid <= getLastCommittedBlockID())
if ( _daProof->getBlockId() <= getLastCommittedBlockID() )
return;


ptr<BooleanProposalVector> pv;


if (getOptimizerAgent()->doOptimizedConsensus(bid, getLastCommittedBlockTimeStamp().getS())) {
// when we do optimized block consensus only a single block proposer
// proposes and provides da proof, which is the previous winner.
Expand All @@ -947,10 +917,13 @@ void Schain::daProofArrived( const ptr< DAProof >& _daProof ) {
pv = getNode()->getDaProofDB()->addDAProof(_daProof);
}

if (pv) {

if ( pv != nullptr ) {
auto bid = _daProof->getBlockId();

// try starting consensus. It may already have been started due to
// block proposal receipt timeout
tryStartingConsensus(pv, bid);
tryStartingConsensus( pv, bid );
}
} catch ( ExitRequestedException& e ) {
throw;
Expand Down Expand Up @@ -1516,9 +1489,26 @@ uint64_t Schain::getVerifyDaSigsPatchTimestampS() const {
return verifyDaSigsPatchTimestampS;
}

mutex Schain::vdsMutex;

bool Schain::fastConsensusPatch(uint64_t _blockTimeStampS) {
return fastConsensusPatchTimestampS != 0 && _blockTimeStampS >= fastConsensusPatchTimestampS;
}

uint64_t Schain::getFastConsensusTimestampS() const {
return fastConsensusPatchTimestampS;
}

#define SET_TIMESTAMP_FROM_CONFIG(TIMESTAMP_NAME) \
{ \
auto& timestamps = getNode()->getPatchTimestamps(); \
if (timestamps.count(#TIMESTAMP_NAME) > 0) { \
TIMESTAMP_NAME = timestamps.at(#TIMESTAMP_NAME); \
} \
}

mutex Schain::vdsMutex;

void Schain::setTimeStampValuesFromConfig() {
SET_TIMESTAMP_FROM_CONFIG(verifyDaSigsPatchTimestampS)
SET_TIMESTAMP_FROM_CONFIG(fastConsensusPatchTimestampS)
}

0 comments on commit 7361cc1

Please sign in to comment.