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 f81eb29 commit f14526b
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1418,12 +1418,6 @@ 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 @@ -2850,7 +2844,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 @@ -2860,7 +2856,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 @@ -3011,7 +3009,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 @@ -3023,7 +3023,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 f14526b

Please sign in to comment.