Skip to content

Commit 9c0d4b1

Browse files
committed
Remove unused mapRequest tracking.
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. Coming from btc@beef7ec4be725beea870a2da510d2817487601ec
1 parent a7b3b4f commit 9c0d4b1

File tree

10 files changed

+5
-86
lines changed

10 files changed

+5
-86
lines changed

src/main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5185,9 +5185,6 @@ void static ProcessGetData(CNode* pfrom, CConnman& connman, std::atomic<bool>& i
51855185
}
51865186
}
51875187

5188-
// Track requests for our stuff.
5189-
GetMainSignals().Inventory(inv.hash);
5190-
51915188
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
51925189
break;
51935190
}
@@ -5480,8 +5477,6 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
54805477
}
54815478
}
54825479

5483-
// Track requests for our stuff
5484-
GetMainSignals().Inventory(inv.hash);
54855480
}
54865481

54875482
if (!vToFetch.empty())

src/qt/guiconstants.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ static const bool DEFAULT_SPLASHSCREEN = true;
2929
#define COLOR_BAREADDRESS QColor(140, 140, 140)
3030
/* Transaction list -- TX status decoration - open until date */
3131
#define COLOR_TX_STATUS_OPENUNTILDATE QColor(64, 64, 255)
32-
/* Transaction list -- TX status decoration - offline */
33-
#define COLOR_TX_STATUS_OFFLINE QColor(192, 192, 192)
3432
/* Transaction list -- TX status decoration - default color */
3533
#define COLOR_BLACK QColor(51, 51, 51)
3634
/* Transaction list -- TX status decoration - conflicted */

src/qt/transactionrecord.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ void TransactionRecord::updateStatus(const CWalletTx& wtx)
521521
bool fConflicted = false;
522522
int depth = 0;
523523
bool isTrusted = wtx.IsTrusted(depth, fConflicted);
524-
const bool isOffline = (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0);
525524
int nBlocksToMaturity = (wtx.IsCoinBase() || wtx.IsCoinStake()) ? std::max(0, (Params().GetConsensus().nCoinbaseMaturity + 1) - depth) : 0;
526525

527526
status.countsForBalance = isTrusted && !(nBlocksToMaturity > 0);
@@ -550,11 +549,7 @@ void TransactionRecord::updateStatus(const CWalletTx& wtx)
550549
status.status = TransactionStatus::Immature;
551550
status.matures_in = nBlocksToMaturity;
552551

553-
if (status.depth >= 0 && !fConflicted) {
554-
// Check if the block was requested by anyone
555-
if (isOffline)
556-
status.status = TransactionStatus::MaturesWarning;
557-
} else {
552+
if (status.depth < 0 || fConflicted) {
558553
status.status = TransactionStatus::NotAccepted;
559554
}
560555
} else {
@@ -564,8 +559,6 @@ void TransactionRecord::updateStatus(const CWalletTx& wtx)
564559
} else {
565560
if (status.depth < 0 || fConflicted) {
566561
status.status = TransactionStatus::Conflicted;
567-
} else if (isOffline) {
568-
status.status = TransactionStatus::Offline;
569562
} else if (status.depth == 0) {
570563
status.status = TransactionStatus::Unconfirmed;
571564
} else if (status.depth < RecommendedNumConfirmations) {
@@ -612,8 +605,6 @@ bool TransactionRecord::isNull() const
612605

613606
std::string TransactionRecord::statusToString(){
614607
switch (status.status){
615-
case TransactionStatus::MaturesWarning:
616-
return "Abandoned (not mature because no nodes have confirmed)";
617608
case TransactionStatus::Confirmed:
618609
return "Confirmed";
619610
case TransactionStatus::OpenUntilDate:

src/qt/transactionrecord.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TransactionStatus
2323
{
2424
public:
2525
TransactionStatus() : countsForBalance(false), sortKey(""),
26-
matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1)
26+
matures_in(0), status(Unconfirmed), depth(0), open_for(0), cur_num_blocks(-1)
2727
{
2828
}
2929

@@ -32,13 +32,11 @@ class TransactionStatus
3232
/// Normal (sent/received) transactions
3333
OpenUntilDate, /**< Transaction not yet final, waiting for date */
3434
OpenUntilBlock, /**< Transaction not yet final, waiting for block */
35-
Offline, /**< Not sent to any other nodes **/
3635
Unconfirmed, /**< Not yet mined into a block **/
3736
Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/
3837
Conflicted, /**< Conflicts with other transaction or mempool **/
3938
/// Generated (mined) transactions
4039
Immature, /**< Mined but waiting for maturity */
41-
MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */
4240
NotAccepted /**< Mined but not accepted */
4341
};
4442

src/qt/transactiontablemodel.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord* wtx) cons
406406
case TransactionStatus::OpenUntilDate:
407407
status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for));
408408
break;
409-
case TransactionStatus::Offline:
410-
status = tr("Offline");
411-
break;
412409
case TransactionStatus::Unconfirmed:
413410
status = tr("Unconfirmed");
414411
break;
@@ -424,9 +421,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord* wtx) cons
424421
case TransactionStatus::Immature:
425422
status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in);
426423
break;
427-
case TransactionStatus::MaturesWarning:
428-
status = tr("This block was not received by any other nodes and will probably not be accepted!");
429-
break;
430424
case TransactionStatus::NotAccepted:
431425
status = tr("Orphan Block - Generated but not accepted. This does not impact your holdings.");
432426
break;
@@ -610,8 +604,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord* wtx)
610604
case TransactionStatus::OpenUntilBlock:
611605
case TransactionStatus::OpenUntilDate:
612606
return COLOR_TX_STATUS_OPENUNTILDATE;
613-
case TransactionStatus::Offline:
614-
return COLOR_TX_STATUS_OFFLINE;
615607
case TransactionStatus::Unconfirmed:
616608
return QIcon(":/icons/transaction_0");
617609
case TransactionStatus::Confirming:
@@ -636,7 +628,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord* wtx)
636628
int part = (wtx->status.depth * 5 / total) + 1;
637629
return QIcon(QString(":/icons/transaction_%1").arg(part));
638630
}
639-
case TransactionStatus::MaturesWarning:
640631
case TransactionStatus::NotAccepted:
641632
return QIcon(":/icons/transaction_0");
642633
default:

src/swifttx.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void ProcessMessageSwiftTX(CNode* pfrom, std::string& strCommand, CDataStream& v
4949

5050
CInv inv(MSG_TXLOCK_REQUEST, tx.GetHash());
5151
pfrom->AddInventoryKnown(inv);
52-
GetMainSignals().Inventory(inv.hash);
5352

5453
if (mapTxLockReq.count(tx.GetHash()) || mapTxLockReqRejected.count(tx.GetHash())) {
5554
return;
@@ -351,13 +350,16 @@ bool ProcessConsensusVote(CNode* pnode, CConsensusVote& ctx)
351350
if (i != mapTxLocks.end()) {
352351
(*i).second.AddSignature(ctx);
353352

353+
// Not enabled swiftx for now, mapRequestCount doesn't exist anymore,
354+
/*
354355
#ifdef ENABLE_WALLET
355356
if (pwalletMain) {
356357
//when we get back signatures, we'll count them as requests. Otherwise the client will think it didn't propagate.
357358
if (pwalletMain->mapRequestCount.count(ctx.txHash))
358359
pwalletMain->mapRequestCount[ctx.txHash]++;
359360
}
360361
#endif
362+
*/
361363

362364
LogPrint(BCLog::MASTERNODE, "%s : Transaction Lock Votes %d - %s !\n", __func__, (*i).second.CountSignatures(), ctx.GetHash().ToString().c_str());
363365

src/validationinterface.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
2020
g_signals.NotifyTransactionLock.connect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1));
2121
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
2222
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
23-
g_signals.Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));
2423
g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1));
2524
g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
2625
// XX42 g_signals.ScriptForMining.connect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1));
@@ -32,7 +31,6 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
3231
// XX42 g_signals.ScriptForMining.disconnect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1));
3332
g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
3433
g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1));
35-
g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));
3634
g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
3735
g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
3836
g_signals.NotifyTransactionLock.disconnect(boost::bind(&CValidationInterface::NotifyTransactionLock, pwalletIn, _1));
@@ -46,7 +44,6 @@ void UnregisterAllValidationInterfaces() {
4644
// XX42 g_signals.ScriptForMining.disconnect_all_slots();
4745
g_signals.BlockChecked.disconnect_all_slots();
4846
g_signals.Broadcast.disconnect_all_slots();
49-
g_signals.Inventory.disconnect_all_slots();
5047
g_signals.SetBestChain.disconnect_all_slots();
5148
g_signals.UpdatedTransaction.disconnect_all_slots();
5249
g_signals.NotifyTransactionLock.disconnect_all_slots();

src/validationinterface.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class CValidationInterface {
3737
virtual void NotifyTransactionLock(const CTransaction &tx) {}
3838
virtual void SetBestChain(const CBlockLocator &locator) {}
3939
virtual bool UpdatedTransaction(const uint256 &hash) { return false;}
40-
virtual void Inventory(const uint256 &hash) {}
4140
virtual void ResendWalletTransactions(CConnman* connman) {}
4241
virtual void BlockChecked(const CBlock&, const CValidationState&) {}
4342
// XX42 virtual void GetScriptForMining(boost::shared_ptr<CReserveScript>&) {};
@@ -61,8 +60,6 @@ struct CMainSignals {
6160
boost::signals2::signal<bool (const uint256 &)> UpdatedTransaction;
6261
/** Notifies listeners of a new active block chain. */
6362
boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
64-
/** Notifies listeners about an inventory item being seen on the network. */
65-
boost::signals2::signal<void (const uint256 &)> Inventory;
6663
/** Tells listeners to broadcast their data. */
6764
boost::signals2::signal<void (CConnman* connman)> Broadcast;
6865
/** Notifies listeners of a block validation result */

src/wallet/wallet.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,39 +1225,6 @@ void CWalletTx::UpdateTimeSmart()
12251225
}
12261226
}
12271227

1228-
int CWalletTx::GetRequestCount() const
1229-
{
1230-
// Returns -1 if it wasn't being tracked
1231-
int nRequests = -1;
1232-
{
1233-
LOCK(pwallet->cs_wallet);
1234-
if (IsCoinBase()) {
1235-
// Generated block
1236-
if (!hashUnset()) {
1237-
std::map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock);
1238-
if (mi != pwallet->mapRequestCount.end())
1239-
nRequests = (*mi).second;
1240-
}
1241-
} else {
1242-
// Did anyone request this transaction?
1243-
std::map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(GetHash());
1244-
if (mi != pwallet->mapRequestCount.end()) {
1245-
nRequests = (*mi).second;
1246-
1247-
// How about the block it's in?
1248-
if (nRequests == 0 && !hashUnset()) {
1249-
std::map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock);
1250-
if (mi != pwallet->mapRequestCount.end())
1251-
nRequests = (*mi).second;
1252-
else
1253-
nRequests = 1; // If it's in someone else's block it must have got out
1254-
}
1255-
}
1256-
}
1257-
}
1258-
return nRequests;
1259-
}
1260-
12611228
CAmount CWalletTx::GetCachableAmount(AmountType type, const isminefilter& filter, bool recalculate) const
12621229
{
12631230
auto& amount = m_amounts[type];
@@ -2928,9 +2895,6 @@ CWallet::CommitResult CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey&
29282895

29292896
res.status = CWallet::CommitStatus::OK;
29302897

2931-
// Track how many getdata requests our transaction gets
2932-
mapRequestCount[res.hashTx] = 0;
2933-
29342898
// Broadcast
29352899
wtxNew.RelayWalletTransaction(connman, strCommand);
29362900
}
@@ -4294,16 +4258,6 @@ CAmount CWallet::GetChange(const CTransaction& tx) const
42944258
return nChange;
42954259
}
42964260

4297-
void CWallet::Inventory(const uint256& hash)
4298-
{
4299-
{
4300-
LOCK(cs_wallet);
4301-
std::map<uint256, int>::iterator mi = mapRequestCount.find(hash);
4302-
if (mi != mapRequestCount.end())
4303-
(*mi).second++;
4304-
}
4305-
}
4306-
43074261
unsigned int CWallet::GetKeyPoolSize()
43084262
{
43094263
return m_spk_man->GetKeyPoolSize();

src/wallet/wallet.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
362362
TxItems wtxOrdered;
363363

364364
int64_t nOrderPosNext;
365-
std::map<uint256, int> mapRequestCount;
366365

367366
std::map<CTxDestination, AddressBook::CAddressBookData> mapAddressBook;
368367

@@ -636,8 +635,6 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
636635

637636
bool UpdatedTransaction(const uint256& hashTx);
638637

639-
void Inventory(const uint256& hash);
640-
641638
unsigned int GetKeyPoolSize();
642639
unsigned int GetStakingKeyPoolSize();
643640

@@ -992,7 +989,6 @@ class CWalletTx : public CMerkleTx
992989

993990
int64_t GetTxTime() const;
994991
void UpdateTimeSmart();
995-
int GetRequestCount() const;
996992
void RelayWalletTransaction(CConnman* connman, std::string strCommand = NetMsgType::TX);
997993
std::set<uint256> GetConflicts() const;
998994
};

0 commit comments

Comments
 (0)