Remove unused adjustedTime parameter

qt: After merging #13622 the `adjustedTime` is not used any more in
wallet related functions.
This commit is contained in:
Hennadii Stepanov
2018-10-23 17:36:46 +03:00
parent 5c25409d68
commit 04972fefd1
7 changed files with 12 additions and 20 deletions

View File

@@ -290,8 +290,7 @@ public:
} }
bool tryGetTxStatus(const uint256& txid, bool tryGetTxStatus(const uint256& txid,
interfaces::WalletTxStatus& tx_status, interfaces::WalletTxStatus& tx_status,
int& num_blocks, int& num_blocks) override
int64_t& adjusted_time) override
{ {
TRY_LOCK(::cs_main, locked_chain); TRY_LOCK(::cs_main, locked_chain);
if (!locked_chain) { if (!locked_chain) {
@@ -306,7 +305,6 @@ public:
return false; return false;
} }
num_blocks = ::chainActive.Height(); num_blocks = ::chainActive.Height();
adjusted_time = GetAdjustedTime();
tx_status = MakeWalletTxStatus(mi->second); tx_status = MakeWalletTxStatus(mi->second);
return true; return true;
} }
@@ -314,14 +312,12 @@ public:
WalletTxStatus& tx_status, WalletTxStatus& tx_status,
WalletOrderForm& order_form, WalletOrderForm& order_form,
bool& in_mempool, bool& in_mempool,
int& num_blocks, int& num_blocks) override
int64_t& adjusted_time) override
{ {
LOCK2(::cs_main, m_wallet.cs_wallet); LOCK2(::cs_main, m_wallet.cs_wallet);
auto mi = m_wallet.mapWallet.find(txid); auto mi = m_wallet.mapWallet.find(txid);
if (mi != m_wallet.mapWallet.end()) { if (mi != m_wallet.mapWallet.end()) {
num_blocks = ::chainActive.Height(); num_blocks = ::chainActive.Height();
adjusted_time = GetAdjustedTime();
in_mempool = mi->second.InMempool(); in_mempool = mi->second.InMempool();
order_form = mi->second.vOrderForm; order_form = mi->second.vOrderForm;
tx_status = MakeWalletTxStatus(mi->second); tx_status = MakeWalletTxStatus(mi->second);

View File

@@ -178,16 +178,14 @@ public:
//! Try to get updated status for a particular transaction, if possible without blocking. //! Try to get updated status for a particular transaction, if possible without blocking.
virtual bool tryGetTxStatus(const uint256& txid, virtual bool tryGetTxStatus(const uint256& txid,
WalletTxStatus& tx_status, WalletTxStatus& tx_status,
int& num_blocks, int& num_blocks) = 0;
int64_t& adjusted_time) = 0;
//! Get transaction details. //! Get transaction details.
virtual WalletTx getWalletTxDetails(const uint256& txid, virtual WalletTx getWalletTxDetails(const uint256& txid,
WalletTxStatus& tx_status, WalletTxStatus& tx_status,
WalletOrderForm& order_form, WalletOrderForm& order_form,
bool& in_mempool, bool& in_mempool,
int& num_blocks, int& num_blocks) = 0;
int64_t& adjusted_time) = 0;
//! Get balances. //! Get balances.
virtual WalletBalances getBalances() = 0; virtual WalletBalances getBalances() = 0;

View File

@@ -23,7 +23,7 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime) QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks)
{ {
if (!status.is_final) if (!status.is_final)
{ {
@@ -49,11 +49,10 @@ QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const i
QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit) QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit)
{ {
int numBlocks; int numBlocks;
int64_t adjustedTime;
interfaces::WalletTxStatus status; interfaces::WalletTxStatus status;
interfaces::WalletOrderForm orderForm; interfaces::WalletOrderForm orderForm;
bool inMempool; bool inMempool;
interfaces::WalletTx wtx = wallet.getWalletTxDetails(rec->hash, status, orderForm, inMempool, numBlocks, adjustedTime); interfaces::WalletTx wtx = wallet.getWalletTxDetails(rec->hash, status, orderForm, inMempool, numBlocks);
QString strHTML; QString strHTML;
@@ -65,7 +64,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
CAmount nDebit = wtx.debit; CAmount nDebit = wtx.debit;
CAmount nNet = nCredit - nDebit; CAmount nNet = nCredit - nDebit;
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx, status, inMempool, numBlocks, adjustedTime); strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx, status, inMempool, numBlocks);
strHTML += "<br>"; strHTML += "<br>";
strHTML += "<b>" + tr("Date") + ":</b> " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "<br>"; strHTML += "<b>" + tr("Date") + ":</b> " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "<br>";

View File

@@ -29,7 +29,7 @@ public:
private: private:
TransactionDesc() {} TransactionDesc() {}
static QString FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime); static QString FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks);
}; };
#endif // BITCOIN_QT_TRANSACTIONDESC_H #endif // BITCOIN_QT_TRANSACTIONDESC_H

View File

@@ -158,7 +158,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
return parts; return parts;
} }
void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime) void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks)
{ {
// Determine transaction status // Determine transaction status

View File

@@ -138,7 +138,7 @@ public:
/** Update status from core wallet tx. /** Update status from core wallet tx.
*/ */
void updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime); void updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks);
/** Return whether a status update is needed. /** Return whether a status update is needed.
*/ */

View File

@@ -193,9 +193,8 @@ public:
// simply re-use the cached status. // simply re-use the cached status.
interfaces::WalletTxStatus wtx; interfaces::WalletTxStatus wtx;
int numBlocks; int numBlocks;
int64_t adjustedTime; if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks) && rec->statusUpdateNeeded(numBlocks)) {
if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, adjustedTime) && rec->statusUpdateNeeded(numBlocks)) { rec->updateStatus(wtx, numBlocks);
rec->updateStatus(wtx, numBlocks, adjustedTime);
} }
return rec; return rec;
} }