forked from Public/monero-gui
@@ -45,11 +45,12 @@ QList<TransactionInfo *> TransactionHistory::getAll() const
|
||||
if (ti->timestamp() <= firstDateTime) {
|
||||
firstDateTime = ti->timestamp();
|
||||
}
|
||||
quint64 requiredConfirmations = (ti->blockHeight() < ti->unlockTime()) ? ti->unlockTime() - ti->blockHeight() : 0;
|
||||
// store last tx height
|
||||
if (ti->confirmations() < 10 && ti->blockHeight() >= lastTxHeight ){
|
||||
if (ti->confirmations() < requiredConfirmations && ti->blockHeight() >= lastTxHeight) {
|
||||
lastTxHeight = ti->blockHeight();
|
||||
// TODO: Fetch block time and confirmations needed from wallet2?
|
||||
m_minutesToUnlock = (10 - ti->confirmations()) * 2;
|
||||
m_minutesToUnlock = (requiredConfirmations - ti->confirmations()) * 2;
|
||||
m_locked = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,11 @@ quint64 TransactionInfo::confirmations() const
|
||||
return m_pimpl->confirmations();
|
||||
}
|
||||
|
||||
quint64 TransactionInfo::unlockTime() const
|
||||
{
|
||||
return m_pimpl->unlockTime();
|
||||
}
|
||||
|
||||
QString TransactionInfo::hash() const
|
||||
{
|
||||
return QString::fromStdString(m_pimpl->hash());
|
||||
|
||||
@@ -19,6 +19,7 @@ class TransactionInfo : public QObject
|
||||
Q_PROPERTY(QString fee READ fee)
|
||||
Q_PROPERTY(quint64 blockHeight READ blockHeight)
|
||||
Q_PROPERTY(quint64 confirmations READ confirmations)
|
||||
Q_PROPERTY(quint64 unlockTime READ unlockTime)
|
||||
Q_PROPERTY(QString hash READ hash)
|
||||
Q_PROPERTY(QDateTime timestamp READ timestamp)
|
||||
Q_PROPERTY(QString date READ date)
|
||||
@@ -44,6 +45,7 @@ public:
|
||||
QString fee() const;
|
||||
quint64 blockHeight() const;
|
||||
quint64 confirmations() const;
|
||||
quint64 unlockTime() const;
|
||||
//! transaction_id
|
||||
QString hash() const;
|
||||
QDateTime timestamp() const;
|
||||
|
||||
@@ -85,6 +85,9 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const
|
||||
case TransactionConfirmationsRole:
|
||||
result = tInfo->confirmations();
|
||||
break;
|
||||
case TransactionConfirmationsRequiredRole:
|
||||
result = (tInfo->blockHeight() < tInfo->unlockTime()) ? tInfo->unlockTime() - tInfo->blockHeight() : 0;
|
||||
break;
|
||||
case TransactionHashRole:
|
||||
result = tInfo->hash();
|
||||
break;
|
||||
@@ -130,6 +133,7 @@ QHash<int, QByteArray> TransactionHistoryModel::roleNames() const
|
||||
roleNames.insert(TransactionFeeRole, "fee");
|
||||
roleNames.insert(TransactionBlockHeightRole, "blockHeight");
|
||||
roleNames.insert(TransactionConfirmationsRole, "confirmations");
|
||||
roleNames.insert(TransactionConfirmationsRequiredRole, "confirmationsRequired");
|
||||
roleNames.insert(TransactionHashRole, "hash");
|
||||
roleNames.insert(TransactionTimeStampRole, "timeStamp");
|
||||
roleNames.insert(TransactionPaymentIdRole, "paymentId");
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
TransactionFeeRole,
|
||||
TransactionBlockHeightRole,
|
||||
TransactionConfirmationsRole,
|
||||
TransactionConfirmationsRequiredRole,
|
||||
TransactionHashRole,
|
||||
TransactionTimeStampRole,
|
||||
TransactionPaymentIdRole,
|
||||
|
||||
Reference in New Issue
Block a user