Skip to content

Commit

Permalink
Merge remote-tracking branch 'mike/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Asherda committed Aug 26, 2022
2 parents 9c8b353 + d823b3f commit 7138052
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
{
// until we have connected to the ETH bridge, after PBaaS has launched, we check each block to see if there is now an
// ETH bridge defined
ConnectedChains.ConfigureEthBridge();
ConnectedChains.ConfigureEthBridge(true);
}

CChainNotarizationData cnd;
Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3572,6 +3572,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin

SetMaxScriptElementSize(nHeight);

if (CConstVerusSolutionVector::GetVersionByHeight(nHeight) >= CActivationHeight::ACTIVATE_PBAAS)
{
ConnectedChains.ConfigureEthBridge();
}

bool fExpensiveChecks = true;
if (fCheckpointsEnabled) {
CBlockIndex *pindexLastCheckpoint = Checkpoints::GetLastCheckpoint(chainparams.Checkpoints());
Expand Down Expand Up @@ -6683,11 +6688,6 @@ bool ProcessNewBlock(bool from_miner, int32_t height, CValidationState &state, c

SetMaxScriptElementSize(nHeight + 1);

if (CConstVerusSolutionVector::GetVersionByHeight(nHeight) >= CActivationHeight::ACTIVATE_PBAAS)
{
ConnectedChains.ConfigureEthBridge();
}

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const std::vecto
}
else
{
notaryConnected = ConnectedChains.ConfigureEthBridge();
notaryConnected = ConnectedChains.ConfigureEthBridge(true);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/pbaas/notarization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4937,6 +4937,10 @@ bool PreCheckFinalizeNotarization(const CTransaction &tx, int32_t outNum, CValid
if (p.evalCode == EVAL_EARNEDNOTARIZATION &&
!ConnectedChains.notarySystems.count(notarization.currencyID))
{
if (!haveFullChain)
{
return true;
}
return state.Error("Earned notarizations are only valid for notary systems");
}

Expand Down
6 changes: 3 additions & 3 deletions src/pbaas/pbaas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3381,7 +3381,7 @@ bool CConnectedChains::IsNotaryAvailable(bool callToCheck)
CheckVerusPBaaSAvailable();
}

bool CConnectedChains::ConfigureEthBridge()
bool CConnectedChains::ConfigureEthBridge(bool callToCheck)
{
// first time through, we initialize the VETH gateway config file
if (!_IsVerusActive())
Expand All @@ -3395,7 +3395,7 @@ bool CConnectedChains::ConfigureEthBridge()
LOCK(cs_main);
if (FirstNotaryChain().IsValid())
{
return IsNotaryAvailable(true);
return IsNotaryAvailable(callToCheck);
}

CRPCChainData vethNotaryChain;
Expand Down Expand Up @@ -3437,7 +3437,7 @@ bool CConnectedChains::ConfigureEthBridge()
cnd.vtx.size() ? cnd.vtx[cnd.forks[cnd.bestChain].back()].second : CPBaaSNotarization(),
CNotarySystemInfo::TYPE_ETH,
CNotarySystemInfo::VERSION_CURRENT)));
return IsNotaryAvailable(true);
return IsNotaryAvailable(callToCheck);
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/pbaas/pbaas.h
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ class CConnectedChains
bool CheckVerusPBaaSAvailable(); // may use RPC to call Verus
bool IsVerusPBaaSAvailable();
bool IsNotaryAvailable(bool callToCheck=false);
bool ConfigureEthBridge();
bool ConfigureEthBridge(bool callToCheck=false);

std::vector<CCurrencyDefinition> GetMergeMinedChains()
{
Expand Down

0 comments on commit 7138052

Please sign in to comment.