mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Show number of InstantSend locks in Debug Console (#2919)
* Implement GetInstantSendLockCount in CInstantSendManager * Add islockCountChanged signal to client model * Show number of InstantSend locks in debug console
This commit is contained in:
parent
013169d63d
commit
a198a04e04
@ -185,6 +185,28 @@ bool CInstantSendDb::HasArchivedInstantSendLock(const uint256& islockHash)
|
||||
return db.Exists(std::make_tuple(std::string("is_a2"), islockHash));
|
||||
}
|
||||
|
||||
size_t CInstantSendDb::GetInstantSendLockCount()
|
||||
{
|
||||
auto it = std::unique_ptr<CDBIterator>(db.NewIterator());
|
||||
auto firstKey = std::make_tuple(std::string("is_i"), uint256());
|
||||
|
||||
it->Seek(firstKey);
|
||||
|
||||
size_t cnt = 0;
|
||||
while (it->Valid()) {
|
||||
decltype(firstKey) curKey;
|
||||
if (!it->GetKey(curKey) || std::get<0>(curKey) != "is_i") {
|
||||
break;
|
||||
}
|
||||
|
||||
cnt++;
|
||||
|
||||
it->Next();
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash)
|
||||
{
|
||||
CInstantSendLockPtr ret;
|
||||
@ -1412,6 +1434,11 @@ CInstantSendLockPtr CInstantSendManager::GetConflictingLock(const CTransaction&
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t CInstantSendManager::GetInstantSendLockCount()
|
||||
{
|
||||
return db.GetInstantSendLockCount();
|
||||
}
|
||||
|
||||
void CInstantSendManager::WorkThreadMain()
|
||||
{
|
||||
while (!workInterrupt) {
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
std::unordered_map<uint256, CInstantSendLockPtr> RemoveConfirmedInstantSendLocks(int nUntilHeight);
|
||||
void RemoveArchivedInstantSendLocks(int nUntilHeight);
|
||||
bool HasArchivedInstantSendLock(const uint256& islockHash);
|
||||
size_t GetInstantSendLockCount();
|
||||
|
||||
CInstantSendLockPtr GetInstantSendLockByHash(const uint256& hash);
|
||||
uint256 GetInstantSendLockHashByTxid(const uint256& txid);
|
||||
@ -159,6 +160,8 @@ public:
|
||||
bool AlreadyHave(const CInv& inv);
|
||||
bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret);
|
||||
|
||||
size_t GetInstantSendLockCount();
|
||||
|
||||
void WorkThreadMain();
|
||||
};
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "masternode-sync.h"
|
||||
#include "privatesend.h"
|
||||
|
||||
#include "llmq/quorums_instantsend.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QDebug>
|
||||
@ -161,6 +163,14 @@ size_t ClientModel::getMempoolDynamicUsage() const
|
||||
return mempool.DynamicMemoryUsage();
|
||||
}
|
||||
|
||||
size_t ClientModel::getInstantSentLockCount() const
|
||||
{
|
||||
if (!llmq::quorumInstantSendManager) {
|
||||
return 0;
|
||||
}
|
||||
return llmq::quorumInstantSendManager->GetInstantSendLockCount();
|
||||
}
|
||||
|
||||
double ClientModel::getVerificationProgress(const CBlockIndex *tipIn) const
|
||||
{
|
||||
CBlockIndex *tip = const_cast<CBlockIndex *>(tipIn);
|
||||
@ -177,6 +187,7 @@ void ClientModel::updateTimer()
|
||||
// no locking required at this point
|
||||
// the following calls will acquire the required lock
|
||||
Q_EMIT mempoolSizeChanged(getMempoolSize(), getMempoolDynamicUsage());
|
||||
Q_EMIT islockCountChanged(getInstantSentLockCount());
|
||||
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,8 @@ public:
|
||||
long getMempoolSize() const;
|
||||
//! Return the dynamic memory usage of the mempool
|
||||
size_t getMempoolDynamicUsage() const;
|
||||
//! Return number of ISLOCKs
|
||||
size_t getInstantSentLockCount() const;
|
||||
|
||||
void setMasternodeList(const CDeterministicMNList& mnList);
|
||||
CDeterministicMNList getMasternodeList() const;
|
||||
@ -117,6 +119,7 @@ Q_SIGNALS:
|
||||
void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress, bool header);
|
||||
void additionalDataSyncProgressChanged(double nSyncProgress);
|
||||
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
|
||||
void islockCountChanged(size_t count);
|
||||
void networkActiveChanged(bool networkActive);
|
||||
void alertsChanged(const QString &warnings);
|
||||
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
|
||||
|
@ -408,6 +408,20 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="labelInstantSendLockCount">
|
||||
<property name="text">
|
||||
<string>InstantSend locks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QLabel" name="instantSendLockCount">
|
||||
<property name="text">
|
||||
<string>N/A</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_console">
|
||||
|
@ -563,6 +563,7 @@ void RPCConsole::setClientModel(ClientModel *model)
|
||||
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
|
||||
|
||||
connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t)));
|
||||
connect(model, SIGNAL(islockCountChanged(size_t)), this, SLOT(setInstantSendLockCount(size_t)));
|
||||
|
||||
// set up peer table
|
||||
ui->peerWidget->setModel(model->getPeerTableModel());
|
||||
@ -906,6 +907,11 @@ void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage)
|
||||
ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB");
|
||||
}
|
||||
|
||||
void RPCConsole::setInstantSendLockCount(size_t count)
|
||||
{
|
||||
ui->instantSendLockCount->setText(QString::number(count));
|
||||
}
|
||||
|
||||
void RPCConsole::on_lineEdit_returnPressed()
|
||||
{
|
||||
QString cmd = ui->lineEdit->text();
|
||||
|
@ -111,6 +111,8 @@ public Q_SLOTS:
|
||||
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
|
||||
/** Set size (number of transactions and memory usage) of the mempool in the UI */
|
||||
void setMempoolSize(long numberOfTxs, size_t dynUsage);
|
||||
/** Set number of InstantSend locks */
|
||||
void setInstantSendLockCount(size_t count);
|
||||
/** Go forward or back in history */
|
||||
void browseHistory(int offset);
|
||||
/** Scroll console view to end */
|
||||
|
Loading…
Reference in New Issue
Block a user