Also, in order to understand how this works, I added age and weight columns to the coin control window. I find it's useful. If you think it's a good addition, feel free to use this patch.
Also, if I messed up on how these are actually calcualted, feel free to correct me
It appears consistent with the total weight displayed in the bottom right corner, at least.
From 76cc57216ac6789972d769185b75e4c4a1de051d Mon Sep 17 00:00:00 2001
From: moneromooo <
[email protected]>
Date: Mon, 25 Aug 2014 09:05:11 +0100
Subject: [PATCH] coincontrol: add age/weight columns
---
src/qt/coincontroldialog.cpp | 16 +++++++++++++++-
src/qt/coincontroldialog.h | 2 ++
src/qt/forms/coincontroldialog.ui | 16 ++++++++++++++++
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index f1008d4..11966a2 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -110,6 +110,8 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) :
ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 290);
ui->treeWidget->setColumnWidth(COLUMN_DATE, 110);
ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100);
+ ui->treeWidget->setColumnWidth(COLUMN_AGE, 60);
+ ui->treeWidget->setColumnWidth(COLUMN_WEIGHT, 60);
ui->treeWidget->setColumnWidth(COLUMN_PRIORITY, 100);
ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transacton hash in this column, but dont show it
ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but dont show it
@@ -622,6 +624,7 @@ void CoinControlDialog::updateView()
double dPrioritySum = 0;
int nChildren = 0;
int nInputSum = 0;
+ int dWeight = 0;
BOOST_FOREACH(const COutput& out, coins.second)
{
int nInputSize = 148; // 180 if uncompressed public key
@@ -683,7 +686,17 @@ void CoinControlDialog::updateView()
// confirmations
itemOutput->setText(COLUMN_CONFIRMATIONS, strPad(QString::number(out.nDepth), 8, " "));
-
+
+ // age
+ float age = (GetTime() - out.tx->GetTxTime()) / (float)(1440 * nTargetStakeSpacing);
+ itemOutput->setText(COLUMN_AGE, strPad(QString::number(age, 'g', 3), 8, " "));
+
+ // weight
+ int weight = floorf((GetTime() - out.tx->GetTxTime() - nStakeMinAge) * out.tx->vout[out.i].nValue / BitcoinUnits::factor(BitcoinUnits::BTC) / (float)(1440 * nTargetStakeSpacing));
+ if (weight < 0) weight = 0;
+ itemOutput->setText(COLUMN_WEIGHT, strPad(QString::number(weight), 5, " "));
+ dWeight += weight;
+
// priority
double dPriority = ((double)out.tx->vout[out.i].nValue / (nInputSize + 78)) * (out.nDepth+1); // 78 = 2 * 34 + 10
itemOutput->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPriority));
@@ -721,6 +734,7 @@ void CoinControlDialog::updateView()
itemWalletAddress->setText(COLUMN_AMOUNT_INT64, strPad(QString::number(nSum), 15, " "));
itemWalletAddress->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPrioritySum));
itemWalletAddress->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64_t)dPrioritySum), 20, " "));
+ itemWalletAddress->setText(COLUMN_WEIGHT, strPad(QString::number((int64_t)dWeight), 5, " "));
}
}
diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h
index 5d0a90b..2f803d5 100644
--- a/src/qt/coincontroldialog.h
+++ b/src/qt/coincontroldialog.h
@@ -57,6 +57,8 @@ private:
COLUMN_ADDRESS,
COLUMN_DATE,
COLUMN_CONFIRMATIONS,
+ COLUMN_AGE,
+ COLUMN_WEIGHT,
COLUMN_PRIORITY,
COLUMN_TXHASH,
COLUMN_VOUT_INDEX,
diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui
index 1364269..f002872 100644
--- a/src/qt/forms/coincontroldialog.ui
+++ b/src/qt/forms/coincontroldialog.ui
@@ -494,6 +494,22 @@
+ Age
+
+
+ Age in days
+
+ +
+
+ Weight
+
+
+ Weight
+
+ +
+
Priority
--
1.9.3