Skip to content

Commit

Permalink
fix: possible assert call if nHeight in CDeterministicMNListDiff is h…
Browse files Browse the repository at this point in the history
…igher than Tip

Example of new log:
```
2023-09-28T17:35:50Z GetProjectedMNPayeesAtChainTip WARNING pindex is nullptr due to height=914160 chain height=914159
```

instead assert call:
```
...
 dashpay#6  0x00007ffff7a33b86 in __assert_fail (assertion=0x55555783afd2 "pindex", file=0x5555577f2ed8 "llmq/utils.cpp", line=730,
        function=0x5555577f2448 "bool llmq::utils::IsMNRewardReallocationActive(const CBlockIndex*)") at ./assert/assert.c:101
 dashpay#7  0x0000555555ab7daf in llmq::utils::IsMNRewardReallocationActive (pindex=<optimized out>) at llmq/utils.cpp:730
 dashpay#8  0x00005555559458ad in CDeterministicMNList::GetProjectedMNPayees (this=this@entry=0x7fffffffc690, pindex=0x0, nCount=<optimized out>, nCount@entry=2147483647)
        at evo/deterministicmns.cpp:231
 dashpay#9  0x000055555594614f in CDeterministicMNList::GetProjectedMNPayeesAtChainTip (this=this@entry=0x7fffffffc690, nCount=nCount@entry=2147483647) at evo/deterministicmns.cpp:216
 dashpay#10 0x00005555558c9f51 in MasternodeList::updateDIP3List (this=this@entry=0x55555908cfd0) at qt/masternodelist.cpp:194
 dashpay#11 0x00005555558ca9a0 in MasternodeList::updateDIP3ListScheduled (this=0x55555908cfd0) at qt/masternodelist.cpp:157
 dashpay#12 0x000055555684a60f in void doActivate<false>(QObject*, int, void**) ()
 dashpay#13 0x00005555568525b1 in QTimer::timerEvent(QTimerEvent*) ()
 dashpay#14 0x0000555556844ce5 in QObject::event(QEvent*) ()
 dashpay#15 0x0000555556ac3252 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
 dashpay#16 0x000055555681e6b8 in QCoreApplication::sendEvent(QObject*, QEvent*) ()
 dashpay#17 0x000055555686de2a in QTimerInfoList::activateTimers() ()
 dashpay#18 0x000055555686be84 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
 dashpay#19 0x00005555569bf8a2 in QXcbUnixEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
 dashpay#20 0x000055555681caf6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
 dashpay#21 0x0000555556825f8a in QCoreApplication::exec() ()
...
```
  • Loading branch information
knst committed Oct 26, 2023
1 parent c034ff0 commit d513c1f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ CDeterministicMNCPtr CDeterministicMNList::GetMNPayee(const CBlockIndex* pIndex)

std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayeesAtChainTip(int nCount) const
{
return GetProjectedMNPayees(::ChainActive()[nHeight], nCount);
const CBlockIndex* const pindex = ::ChainActive()[nHeight];
if (pindex == nullptr) {
LogPrintf("GetProjectedMNPayeesAtChainTip WARNING pindex is nullptr due to height=%lld chain height=%lld\n", nHeight, ::ChainActive().Tip()->nHeight);
return {};
}
return GetProjectedMNPayees(pindex, nCount);
}

std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayees(const CBlockIndex* const pindex, int nCount) const
Expand Down

0 comments on commit d513c1f

Please sign in to comment.