Добавлен столбец показывающий потенциальную PoS награду.
#include "base58.h"
#include "main.h"
+#include <math.h>
+
using namespace std;
bool KernelRecord::showTransaction(const CWalletTx &wtx)
return (GetAdjustedTime() - nTime) / 86400;
}
+double KernelRecord::getPoSReward(double difficulty, int minutes)
+{
+ double PoSReward;
+ int nWeight = GetAdjustedTime() - nTime + minutes * 60;
+ if( nWeight < nStakeMinAge)
+ return 0;
+ uint64 coinAge = (nValue * nWeight ) / (COIN * 86400);
+ double nRewardCoinYear = floor(pow((0.03125 / difficulty), 1.0/3) *100)/100;
+ PoSReward = (coinAge * nRewardCoinYear )/365;
+ PoSReward = min(PoSReward,10.0);
+ return PoSReward;
+}
+
double KernelRecord::getProbToMintStake(double difficulty, int timeOffset) const
{
//double maxTarget = pow(static_cast<double>(2), 224);
int64 getAge() const;
double getProbToMintStake(double difficulty, int timeOffset = 0) const;
double getProbToMintWithinNMinutes(double difficulty, int minutes);
+ double getPoSReward(double difficulty, int timeOffset);
protected:
int prevMinutes;
double prevDifficulty;
<translation>Вероятность PoS</translation>
</message>
<message>
+ <source>MintReward</source>
+ <translation>Награда PoS</translation>
+ </message>
+ <message>
<source>minutes</source>
<translation>минут</translation>
</message>
<source>Chance to mint a block within given time interval.</source>
<translation>Шанс найти блок в течение выбранного временного интервала.</translation>
</message>
+ <message>
+ <source>The size of the potential rewards if the block is found at the beginning and the end given time interval.</source>
+ <translation>Размер потенциальной награды если блок найден в начале и конце выбранного временного интервала.</translation>
+ </message>
</context>
<context>
<name>QObject</name>
<message>
+ <source>Potential PoS reward = from %1 to %2 </source>
+ <translation>Потенциальная PoS награда = от %1 до %2 </translation>
+ </message>
+ <message>
<source>%1 d</source>
<translation>%1 д</translation>
</message>
extern double GetDifficulty(const CBlockIndex* blockindex);
static int column_alignments[] = {
- Qt::AlignLeft|Qt::AlignVCenter,
- Qt::AlignLeft|Qt::AlignVCenter,
- Qt::AlignRight|Qt::AlignVCenter,
- Qt::AlignRight|Qt::AlignVCenter,
- Qt::AlignRight|Qt::AlignVCenter,
- Qt::AlignRight|Qt::AlignVCenter
+ Qt::AlignCenter|Qt::AlignVCenter,
+ Qt::AlignCenter|Qt::AlignVCenter,
+ Qt::AlignCenter|Qt::AlignVCenter,
+ Qt::AlignCenter|Qt::AlignVCenter,
+ Qt::AlignCenter|Qt::AlignVCenter,
+ Qt::AlignCenter|Qt::AlignVCenter,
+ Qt::AlignCenter|Qt::AlignVCenter
};
struct TxLessThan
mintingInterval(10),
priv(new MintingTablePriv(wallet, this))
{
- columns << tr("Transaction") << tr("Address") << tr("Age") << tr("Balance") << tr("CoinDay") << tr("MintProbability");
+ columns << tr("Transaction") << tr("Address") << tr("Age") << tr("Balance") << tr("CoinDay") << tr("MintProbability") << tr("MintReward");
priv->refreshWallet();
QTimer *timer = new QTimer(this);
return formatTxCoinDay(rec);
case MintProbability:
return formatDayToMint(rec);
+ case MintReward:
+ return formatTxPoSReward(rec);
}
break;
case Qt::TextAlignmentRole:
return rec->nValue;
case MintProbability:
return getDayToMint(rec);
+ case MintReward:
+ return formatTxPoSReward(rec);
}
break;
case Qt::BackgroundColorRole:
return description;
}
+QString MintingTableModel::formatTxPoSReward(KernelRecord *wtx) const
+{
+ QString posReward;
+ const CBlockIndex *p = GetLastBlockIndex(pindexBest, true);
+ double difficulty = GetDifficulty(p);
+ posReward += QString(QObject::tr("Potential PoS reward = from %1 to %2 ")).arg(QString::number(wtx->getPoSReward(difficulty, 0),'f', 6),
+ QString::number(wtx->getPoSReward(difficulty, mintingInterval),'f', 6));
+ return posReward;
+}
+
double MintingTableModel::getDayToMint(KernelRecord *wtx) const
{
const CBlockIndex *p = GetLastBlockIndex(pindexBest, true);
return tr("Coin age in the output.");
case MintProbability:
return tr("Chance to mint a block within given time interval.");
+ case MintReward:
+ return tr("The size of the potential rewards if the block is found at the beginning and the end given time interval.");
}
}
}
Age = 2,
Balance = 3,
CoinDay = 4,
- MintProbability = 5
+ MintProbability = 5,
+ MintReward = 6
};
QString formatTxAge(const KernelRecord *wtx) const;
QString formatTxBalance(const KernelRecord *wtx) const;
QString formatTxCoinDay(const KernelRecord *wtx) const;
+ QString formatTxPoSReward(KernelRecord *wtx) const;
private slots:
void update();
mintingView->verticalHeader()->hide();
mintingView->horizontalHeader()->resizeSection(
- MintingTableModel::Address, 420);
+ MintingTableModel::Address, 300);
#if QT_VERSION < 0x050000
mintingView->horizontalHeader()->setResizeMode(
MintingTableModel::TxHash, QHeaderView::Stretch);
mintingView->horizontalHeader()->resizeSection(
MintingTableModel::CoinDay,120);
mintingView->horizontalHeader()->resizeSection(
- MintingTableModel::MintProbability, 160);
+ MintingTableModel::MintProbability, 120);
+ mintingView->horizontalHeader()->resizeSection(
+ MintingTableModel::MintReward, 300);
}
}
writer.addColumn(tr("CoinDay"), 0, MintingTableModel::CoinDay);
writer.addColumn(tr("Balance"), 0, MintingTableModel::Balance);
writer.addColumn(tr("MintingProbability"), 0, MintingTableModel::MintProbability);
+ writer.addColumn(tr("MintingReward"), 0, MintingTableModel::MintReward);
if(!writer.write())
{