mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
* Merge #13622: Remove mapRequest tracking that just effects Qt display. beef7ec4be725beea870a2da510d2817487601ec Remove useless mapRequest tracking that just effects Qt display. (Matt Corallo) Pull request description: I thought we had removed this a long time ago, TBH, its really confusing feedback to users that we display whether a tx was broadcast to immediate neighbor nodes, given that has little indication of whether the tx propagated very far. Tree-SHA512: c9d0808fb60146919bb78d0860ec2193601966c944887eaae7837408422f7e85dfdb306407a613200cdd4726aec66da18df618ebc6a8cfe8650bf08d4a8dc155 Signed-off-by: pasta <pasta@dashboost.org> * drop TX_STATUS_OFFLINE Signed-off-by: pasta <pasta@dashboost.org> Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
This commit is contained in:
parent
e13c746a7d
commit
37af70a188
@ -1674,9 +1674,6 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm
|
||||
|
||||
if (!push)
|
||||
vNotFound.push_back(inv);
|
||||
|
||||
// Track requests for our stuff.
|
||||
GetMainSignals().Inventory(inv.hash);
|
||||
}
|
||||
} // release cs_main
|
||||
|
||||
@ -2511,9 +2508,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Track requests for our stuff
|
||||
GetMainSignals().Inventory(inv.hash);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -160,7 +160,6 @@ static const std::map<ThemedColor, QColor> themedColors = {
|
||||
{ ThemedColor::GREEN, QColor(8, 110, 3) },
|
||||
{ ThemedColor::BAREADDRESS, QColor(140, 140, 140) },
|
||||
{ ThemedColor::TX_STATUS_OPENUNTILDATE, QColor(64, 64, 255) },
|
||||
{ ThemedColor::TX_STATUS_OFFLINE, QColor(192, 192, 192) },
|
||||
{ ThemedColor::TX_STATUS_DANGER, QColor(168, 72, 50) },
|
||||
{ ThemedColor::TX_STATUS_LOCKED, QColor(28, 117, 188) },
|
||||
{ ThemedColor::BACKGROUND_WIDGET, QColor(234, 234, 236) },
|
||||
@ -176,7 +175,6 @@ static const std::map<ThemedColor, QColor> themedDarkColors = {
|
||||
{ ThemedColor::GREEN, QColor(8, 110, 3) },
|
||||
{ ThemedColor::BAREADDRESS, QColor(140, 140, 140) },
|
||||
{ ThemedColor::TX_STATUS_OPENUNTILDATE, QColor(64, 64, 255) },
|
||||
{ ThemedColor::TX_STATUS_OFFLINE, QColor(192, 192, 192) },
|
||||
{ ThemedColor::TX_STATUS_DANGER, QColor(168, 72, 50) },
|
||||
{ ThemedColor::TX_STATUS_LOCKED, QColor(28, 117, 188) },
|
||||
{ ThemedColor::BACKGROUND_WIDGET, QColor(45, 45, 46) },
|
||||
|
@ -50,8 +50,6 @@ namespace GUIUtil
|
||||
BAREADDRESS,
|
||||
/* Transaction list -- TX status decoration - open until date */
|
||||
TX_STATUS_OPENUNTILDATE,
|
||||
/* Transaction list -- TX status decoration - offline */
|
||||
TX_STATUS_OFFLINE,
|
||||
/* Transaction list -- TX status decoration - danger, tx needs attention */
|
||||
TX_STATUS_DANGER,
|
||||
/* Transaction list -- TX status decoration - LockedByInstantSend color */
|
||||
|
@ -38,12 +38,9 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
|
||||
if (nDepth < 0) return tr("conflicted");
|
||||
|
||||
QString strTxStatus;
|
||||
bool fOffline = (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60) && (wtx.GetRequestCount() == 0);
|
||||
bool fChainLocked = wtx.IsChainLocked();
|
||||
|
||||
if (fOffline) {
|
||||
strTxStatus = tr("%1/offline").arg(nDepth);
|
||||
} else if (nDepth == 0) {
|
||||
if (nDepth == 0) {
|
||||
strTxStatus = tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool"))) + (wtx.isAbandoned() ? ", "+tr("abandoned") : "");
|
||||
} else if (!fChainLocked && nDepth < 6) {
|
||||
strTxStatus = tr("%1/unconfirmed").arg(nDepth);
|
||||
@ -77,14 +74,6 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
CAmount nNet = nCredit - nDebit;
|
||||
|
||||
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
|
||||
int nRequests = wtx.GetRequestCount();
|
||||
if (nRequests != -1)
|
||||
{
|
||||
if (nRequests == 0)
|
||||
strHTML += tr(", has not been successfully broadcast yet");
|
||||
else if (nRequests > 0)
|
||||
strHTML += tr(", broadcast through %n node(s)", "", nRequests);
|
||||
}
|
||||
strHTML += "<br>";
|
||||
|
||||
strHTML += "<b>" + tr("Date") + ":</b> " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "<br>";
|
||||
|
@ -319,10 +319,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx, int chainLockHeight)
|
||||
if (wtx.IsInMainChain())
|
||||
{
|
||||
status.matures_in = wtx.GetBlocksToMaturity();
|
||||
|
||||
// Check if the block was requested by anyone
|
||||
if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
|
||||
status.status = TransactionStatus::MaturesWarning;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -351,10 +347,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx, int chainLockHeight)
|
||||
{
|
||||
status.status = TransactionStatus::Conflicted;
|
||||
}
|
||||
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
|
||||
{
|
||||
status.status = TransactionStatus::Offline;
|
||||
}
|
||||
else if (status.depth == 0)
|
||||
{
|
||||
status.status = TransactionStatus::Unconfirmed;
|
||||
|
@ -22,7 +22,7 @@ class TransactionStatus
|
||||
public:
|
||||
TransactionStatus():
|
||||
countsForBalance(false), lockedByInstantSend(false), lockedByChainLocks(false), sortKey(""),
|
||||
matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1),
|
||||
matures_in(0), status(Unconfirmed), depth(0), open_for(0), cur_num_blocks(-1),
|
||||
cachedChainLockHeight(-1), needsUpdate(false)
|
||||
{ }
|
||||
|
||||
@ -31,14 +31,12 @@ public:
|
||||
/// Normal (sent/received) transactions
|
||||
OpenUntilDate, /**< Transaction not yet final, waiting for date */
|
||||
OpenUntilBlock, /**< Transaction not yet final, waiting for block */
|
||||
Offline, /**< Not sent to any other nodes **/
|
||||
Unconfirmed, /**< Not yet mined into a block **/
|
||||
Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/
|
||||
Conflicted, /**< Conflicts with other transaction or mempool **/
|
||||
Abandoned, /**< Abandoned from the wallet **/
|
||||
/// Generated (mined) transactions
|
||||
Immature, /**< Mined but waiting for maturity */
|
||||
MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */
|
||||
NotAccepted /**< Mined but not accepted */
|
||||
};
|
||||
|
||||
|
@ -336,9 +336,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
|
||||
case TransactionStatus::OpenUntilDate:
|
||||
status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for));
|
||||
break;
|
||||
case TransactionStatus::Offline:
|
||||
status = tr("Offline");
|
||||
break;
|
||||
case TransactionStatus::Unconfirmed:
|
||||
status = tr("Unconfirmed");
|
||||
break;
|
||||
@ -357,9 +354,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
|
||||
case TransactionStatus::Immature:
|
||||
status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in);
|
||||
break;
|
||||
case TransactionStatus::MaturesWarning:
|
||||
status = tr("This block was not received by any other nodes and will probably not be accepted!");
|
||||
break;
|
||||
case TransactionStatus::NotAccepted:
|
||||
status = tr("Generated but not accepted");
|
||||
break;
|
||||
@ -520,8 +514,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
||||
case TransactionStatus::OpenUntilBlock:
|
||||
case TransactionStatus::OpenUntilDate:
|
||||
return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::TX_STATUS_OPENUNTILDATE);
|
||||
case TransactionStatus::Offline:
|
||||
return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::TX_STATUS_OFFLINE);
|
||||
case TransactionStatus::Unconfirmed:
|
||||
return QIcon(":/icons/transaction_0");
|
||||
case TransactionStatus::Abandoned:
|
||||
@ -544,7 +536,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
||||
int part = (wtx->status.depth * 5 / total) + 1;
|
||||
return QIcon(QString(":/icons/transaction_%1").arg(part));
|
||||
}
|
||||
case TransactionStatus::MaturesWarning:
|
||||
case TransactionStatus::NotAccepted:
|
||||
return QIcon(":/icons/transaction_0");
|
||||
default:
|
||||
|
@ -27,7 +27,6 @@ struct MainSignalsInstance {
|
||||
boost::signals2::signal<void (const std::shared_ptr<const CBlock> &, const CBlockIndex* pindexDisconnected)> BlockDisconnected;
|
||||
boost::signals2::signal<void (const CTransactionRef &)> TransactionRemovedFromMempool;
|
||||
boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
|
||||
boost::signals2::signal<void (const uint256 &)> Inventory;
|
||||
boost::signals2::signal<void (int64_t nBestBlockTime, CConnman* connman)> Broadcast;
|
||||
boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
|
||||
boost::signals2::signal<void (const CBlockIndex *, const std::shared_ptr<const CBlock>&)> NewPoWValidBlock;
|
||||
@ -94,7 +93,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
||||
g_signals.m_internals->NotifyChainLock.connect(boost::bind(&CValidationInterface::NotifyChainLock, pwalletIn, _1, _2));
|
||||
g_signals.m_internals->TransactionRemovedFromMempool.connect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, _1));
|
||||
g_signals.m_internals->SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
||||
g_signals.m_internals->Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));
|
||||
g_signals.m_internals->Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2));
|
||||
g_signals.m_internals->BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
|
||||
g_signals.m_internals->NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2));
|
||||
@ -107,7 +105,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
||||
void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
||||
g_signals.m_internals->BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
|
||||
g_signals.m_internals->Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2));
|
||||
g_signals.m_internals->Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));
|
||||
g_signals.m_internals->SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
||||
g_signals.m_internals->NotifyChainLock.disconnect(boost::bind(&CValidationInterface::NotifyChainLock, pwalletIn, _1, _2));
|
||||
g_signals.m_internals->NotifyTransactionLock.disconnect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1, _2));
|
||||
@ -132,7 +129,6 @@ void UnregisterAllValidationInterfaces() {
|
||||
}
|
||||
g_signals.m_internals->BlockChecked.disconnect_all_slots();
|
||||
g_signals.m_internals->Broadcast.disconnect_all_slots();
|
||||
g_signals.m_internals->Inventory.disconnect_all_slots();
|
||||
g_signals.m_internals->SetBestChain.disconnect_all_slots();
|
||||
g_signals.m_internals->NotifyTransactionLock.disconnect_all_slots();
|
||||
g_signals.m_internals->NotifyChainLock.disconnect_all_slots();
|
||||
@ -207,12 +203,6 @@ void CMainSignals::SetBestChain(const CBlockLocator &locator) {
|
||||
});
|
||||
}
|
||||
|
||||
void CMainSignals::Inventory(const uint256 &hash) {
|
||||
m_internals->m_schedulerClient.AddToProcessQueue([hash, this] {
|
||||
m_internals->Inventory(hash);
|
||||
});
|
||||
}
|
||||
|
||||
void CMainSignals::Broadcast(int64_t nBestBlockTime, CConnman* connman) {
|
||||
m_internals->Broadcast(nBestBlockTime, connman);
|
||||
}
|
||||
|
@ -117,12 +117,6 @@ protected:
|
||||
* Called on a background thread.
|
||||
*/
|
||||
virtual void SetBestChain(const CBlockLocator &locator) {}
|
||||
/**
|
||||
* Notifies listeners about an inventory item being seen on the network.
|
||||
*
|
||||
* Called on a background thread.
|
||||
*/
|
||||
virtual void Inventory(const uint256 &hash) {}
|
||||
/** Tells listeners to broadcast their data. */
|
||||
virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {}
|
||||
/**
|
||||
@ -182,7 +176,6 @@ public:
|
||||
void NotifyInstantSendDoubleSpendAttempt(const CTransaction ¤tTx, const CTransaction &previousTx);
|
||||
void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff);
|
||||
void SetBestChain(const CBlockLocator &);
|
||||
void Inventory(const uint256 &);
|
||||
void Broadcast(int64_t nBestBlockTime, CConnman* connman);
|
||||
void BlockChecked(const CBlock&, const CValidationState&);
|
||||
void NewPoWValidBlock(const CBlockIndex *, const std::shared_ptr<const CBlock>&);
|
||||
|
@ -1901,45 +1901,6 @@ int64_t CWalletTx::GetTxTime() const
|
||||
return n ? n : nTimeReceived;
|
||||
}
|
||||
|
||||
int CWalletTx::GetRequestCount() const
|
||||
{
|
||||
// Returns -1 if it wasn't being tracked
|
||||
int nRequests = -1;
|
||||
{
|
||||
LOCK(pwallet->cs_wallet);
|
||||
if (IsCoinBase())
|
||||
{
|
||||
// Generated block
|
||||
if (!hashUnset())
|
||||
{
|
||||
std::map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock);
|
||||
if (mi != pwallet->mapRequestCount.end())
|
||||
nRequests = (*mi).second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Did anyone request this transaction?
|
||||
std::map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(GetHash());
|
||||
if (mi != pwallet->mapRequestCount.end())
|
||||
{
|
||||
nRequests = (*mi).second;
|
||||
|
||||
// How about the block it's in?
|
||||
if (nRequests == 0 && !hashUnset())
|
||||
{
|
||||
std::map<uint256, int>::const_iterator _mi = pwallet->mapRequestCount.find(hashBlock);
|
||||
if (_mi != pwallet->mapRequestCount.end())
|
||||
nRequests = (*_mi).second;
|
||||
else
|
||||
nRequests = 1; // If it's in someone else's block it must have got out
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nRequests;
|
||||
}
|
||||
|
||||
void CWalletTx::GetAmounts(std::list<COutputEntry>& listReceived,
|
||||
std::list<COutputEntry>& listSent, CAmount& nFee, std::string& strSentAccount, const isminefilter& filter) const
|
||||
{
|
||||
@ -4093,9 +4054,6 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CCon
|
||||
}
|
||||
}
|
||||
|
||||
// Track how many getdata requests our transaction gets
|
||||
mapRequestCount[wtxNew.GetHash()] = 0;
|
||||
|
||||
// Get the inserted-CWalletTx from mapWallet so that the
|
||||
// fInMempool flag is cached properly
|
||||
CWalletTx& wtx = mapWallet[wtxNew.GetHash()];
|
||||
|
@ -505,7 +505,6 @@ public:
|
||||
bool IsTrusted() const;
|
||||
|
||||
int64_t GetTxTime() const;
|
||||
int GetRequestCount() const;
|
||||
|
||||
// RelayWalletTransaction may only be called if fBroadcastTransactions!
|
||||
bool RelayWalletTransaction(CConnman* connman);
|
||||
@ -882,7 +881,6 @@ public:
|
||||
|
||||
int64_t nOrderPosNext;
|
||||
uint64_t nAccountingEntryNumber;
|
||||
std::map<uint256, int> mapRequestCount;
|
||||
|
||||
std::map<CTxDestination, CAddressBookData> mapAddressBook;
|
||||
|
||||
@ -1137,16 +1135,6 @@ public:
|
||||
|
||||
const std::string& GetAccountName(const CScript& scriptPubKey) const;
|
||||
|
||||
void Inventory(const uint256 &hash) override
|
||||
{
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
std::map<uint256, int>::iterator mi = mapRequestCount.find(hash);
|
||||
if (mi != mapRequestCount.end())
|
||||
(*mi).second++;
|
||||
}
|
||||
}
|
||||
|
||||
void GetScriptForMining(std::shared_ptr<CReserveScript> &script);
|
||||
|
||||
unsigned int GetKeyPoolSize()
|
||||
|
Loading…
Reference in New Issue
Block a user