Skip to content

Commit

Permalink
Skip pburnHistoryDB if nullptr for C++ tests. Remove height on burn.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Apr 29, 2021
1 parent 75148b1 commit 7e64ffc
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,15 +1410,6 @@ void InitScriptExecutionCache() {

bool CheckBurnSpend(const CTransaction &tx, const CCoinsViewCache &inputs)
{
// Block should always be found.
auto const block = LookupBlockIndex(inputs.GetBestBlock());

// Skip check below Eunos, if no burn spend after Eunos this can be removed.
if (block && block->nHeight < Params().GetConsensus().EunosHeight)
{
return true;
}

Coin coin;
for(size_t i = 0; i < tx.vin.size(); ++i)
{
Expand Down Expand Up @@ -2866,7 +2857,9 @@ bool CChainState::DisconnectTip(CValidationState& state, const CChainParams& cha
if (paccountHistoryDB) {
paccountHistoryDB->Discard();
}
pburnHistoryDB->Discard();
if (pburnHistoryDB) {
pburnHistoryDB->Discard();
}
return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString());
}
bool flushed = view.Flush() && mnview.Flush();
Expand All @@ -2876,7 +2869,9 @@ bool CChainState::DisconnectTip(CValidationState& state, const CChainParams& cha
if (paccountHistoryDB) {
paccountHistoryDB->Flush();
}
pburnHistoryDB->Flush();
if (pburnHistoryDB) {
pburnHistoryDB->Flush();
}

if (!disconnectedConfirms.empty()) {
for (auto const & confirm : disconnectedConfirms) {
Expand Down Expand Up @@ -3027,7 +3022,9 @@ bool CChainState::ConnectTip(CValidationState& state, const CChainParams& chainp
if (paccountHistoryDB) {
paccountHistoryDB->Discard();
}
pburnHistoryDB->Discard();
if (pburnHistoryDB) {
pburnHistoryDB->Discard();
}
return error("%s: ConnectBlock %s failed, %s", __func__, pindexNew->GetBlockHash().ToString(), FormatStateMessage(state));
}
nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
Expand All @@ -3039,7 +3036,9 @@ bool CChainState::ConnectTip(CValidationState& state, const CChainParams& chainp
if (paccountHistoryDB) {
paccountHistoryDB->Flush();
}
pburnHistoryDB->Flush();
if (pburnHistoryDB) {
pburnHistoryDB->Flush();
}

// anchor rewards re-voting etc...
if (!rewardedAnchors.empty()) {
Expand Down

0 comments on commit 7e64ffc

Please sign in to comment.