mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
History: set default description to Coinbase for mining outputs
This commit is contained in:
parent
4a3604a3b8
commit
c247962c21
2 changed files with 20 additions and 10 deletions
|
@ -103,11 +103,7 @@ void TransactionHistory::refresh()
|
||||||
t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
|
t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
|
||||||
t->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
|
t->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
|
||||||
t->m_unlockTime = pd.m_unlock_time;
|
t->m_unlockTime = pd.m_unlock_time;
|
||||||
|
t->m_description = description(pd);
|
||||||
t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
|
|
||||||
if (t->m_description.isEmpty()) {
|
|
||||||
t->m_description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rows.append(t);
|
m_rows.append(t);
|
||||||
}
|
}
|
||||||
|
@ -254,11 +250,7 @@ void TransactionHistory::refresh()
|
||||||
t->m_label = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
|
t->m_label = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
|
||||||
t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
|
t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
|
||||||
t->m_confirmations = 0;
|
t->m_confirmations = 0;
|
||||||
|
t->m_description = description(pd);
|
||||||
t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
|
|
||||||
if (t->m_description.isEmpty()) {
|
|
||||||
t->m_description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rows.append(t);
|
m_rows.append(t);
|
||||||
|
|
||||||
|
@ -393,3 +385,20 @@ bool TransactionHistory::writeCSV(const QString &path) {
|
||||||
data = QString("blockHeight,timestamp,date,accountIndex,direction,balanceDelta,amount,fee,txid,description,paymentId,fiatAmount,fiatCurrency%1").arg(data);
|
data = QString("blockHeight,timestamp,date,accountIndex,direction,balanceDelta,amount,fee,txid,description,paymentId,fiatAmount,fiatCurrency%1").arg(data);
|
||||||
return Utils::fileWrite(path, data);
|
return Utils::fileWrite(path, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString TransactionHistory::description(const tools::wallet2::payment_details &pd)
|
||||||
|
{
|
||||||
|
QString description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
|
||||||
|
if (description.isEmpty()) {
|
||||||
|
if (pd.m_coinbase) {
|
||||||
|
description = "Coinbase";
|
||||||
|
}
|
||||||
|
else if (pd.m_subaddr_index.major == 0 && pd.m_subaddr_index.minor == 0) {
|
||||||
|
description = "Primary address";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return description;
|
||||||
|
}
|
|
@ -51,6 +51,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit TransactionHistory(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent = nullptr);
|
explicit TransactionHistory(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent = nullptr);
|
||||||
|
QString description(const tools::wallet2::payment_details &pd);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Wallet;
|
friend class Wallet;
|
||||||
|
|
Loading…
Reference in a new issue