Skip to content

Commit

Permalink
Add logging to debug transaction write to poll refresh issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Dec 1, 2023
1 parent 3dd263a commit 1926b06
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gridcoin/voting/result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,13 @@ class VoteCounter

{
LOCK(cs_tx_val_commit_to_disk);
LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: cs_tx_val_commit_to_disk locked", __func__);

if (!m_txdb.ReadDiskTx(txid, tx)) {
LogPrintf("WARN: %s: failed to read vote tx.", __func__);
}

LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: cs_tx_val_commit_to_disk unlocked", __func__);
}


Expand Down
10 changes: 10 additions & 0 deletions src/qt/voting/polltablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "qt/voting/polltablemodel.h"
#include "qt/voting/votingmodel.h"
#include "logging.h"
#include "util.h"
#include "util/threadnames.h"

#include <QtConcurrentRun>
#include <QSortFilterProxyModel>
Expand Down Expand Up @@ -260,13 +262,21 @@ void PollTableModel::refresh()
__func__);

return;
} else {
LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: m_refresh_mutex trylock succeeded.",
__func__);
}

QtConcurrent::run([this]() {
RenameThread("PollTableModel_refresh");
util::ThreadSetInternalName("PollTableModel_refresh");

static_cast<PollTableDataModel*>(m_data_model.get())
->reload(m_voting_model->buildPollTable(m_filter_flags));

m_refresh_mutex.unlock();
LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: m_refresh_mutex lock released.",
__func__);
});
}

Expand Down
3 changes: 3 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,7 @@ bool ConnectBlock(CBlock& block, CTxDB& txdb, CBlockIndex* pindex, bool fJustChe
// to take this lock to ensure that the write to leveldb and the access of the transaction data by the signal handlers is
// appropriately serialized.
LOCK(cs_tx_val_commit_to_disk);
LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: cs_tx_val_commit_to_disk locked", __func__);

if (IsResearchAgeEnabled(pindex->nHeight)
&& !GridcoinConnectBlock(block, pindex, txdb, stake_value_in, nStakeReward, nFees))
Expand All @@ -1674,6 +1675,8 @@ bool ConnectBlock(CBlock& block, CTxDB& txdb, CBlockIndex* pindex, bool fJustChe
if (!txdb.UpdateTxIndex(hash, index))
return error("%s: UpdateTxIndex failed", __func__);
}

LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: cs_tx_val_commit_to_disk unlocked", __func__);
}

// Update block index on disk without changing it in memory.
Expand Down

0 comments on commit 1926b06

Please sign in to comment.