From bde7273c9f95e9710d71203b42d57eab9abf4b41 Mon Sep 17 00:00:00 2001 From: Duke Date: Tue, 14 Mar 2023 15:54:28 -0400 Subject: [PATCH] Remove mapRequest tracking --- src/main.cpp | 6 ------ src/miner.cpp | 7 ------- src/validationinterface.cpp | 5 ----- src/validationinterface.h | 4 ---- src/wallet/wallet.cpp | 3 --- src/wallet/wallet.h | 16 ---------------- 6 files changed, 41 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 220c0aa0b..2ba00b6d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6841,9 +6841,6 @@ void static ProcessGetData(CNode* pfrom) } } - // Track requests for our stuff. - GetMainSignals().Inventory(inv.hash); - if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) break; } @@ -7320,9 +7317,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } } - // Track requests for our stuff - GetMainSignals().Inventory(inv.hash); - if (pfrom->nSendSize > (SendBufferSize() * 2)) { Misbehaving(pfrom->GetId(), 50); return error("send buffer size() = %u", pfrom->nSendSize); diff --git a/src/miner.cpp b/src/miner.cpp index f677d6b43..4e5e01216 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -924,13 +924,6 @@ static bool ProcessBlockFound(CBlock* pblock) reservekey.KeepKey(); } } - // Track how many getdata requests this block gets - //if ( 0 ) - { - //fprintf(stderr,"lock cs_wallet\n"); - LOCK(wallet.cs_wallet); - wallet.mapRequestCount[pblock->GetHash()] = 0; - } #endif //fprintf(stderr,"process new block\n"); diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index a5eb77e94..d16b235bf 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -31,19 +31,15 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3)); g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); - g_signals.Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); //g_signals.ScriptForMining.connect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1)); - g_signals.BlockFound.connect(boost::bind(&CValidationInterface::ResetRequestCount, pwalletIn, _1)); } void UnregisterValidationInterface(CValidationInterface* pwalletIn) { - g_signals.BlockFound.disconnect(boost::bind(&CValidationInterface::ResetRequestCount, pwalletIn, _1)); //g_signals.ScriptForMining.disconnect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1)); g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); - g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.ChainTip.disconnect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3)); g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); @@ -57,7 +53,6 @@ void UnregisterAllValidationInterfaces() { //g_signals.ScriptForMining.disconnect_all_slots(); g_signals.BlockChecked.disconnect_all_slots(); g_signals.Broadcast.disconnect_all_slots(); - g_signals.Inventory.disconnect_all_slots(); g_signals.ChainTip.disconnect_all_slots(); g_signals.SetBestChain.disconnect_all_slots(); g_signals.UpdatedTransaction.disconnect_all_slots(); diff --git a/src/validationinterface.h b/src/validationinterface.h index 122976f51..e815b6d57 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -40,10 +40,8 @@ protected: virtual void ChainTip(const CBlockIndex *pindex, const CBlock *pblock, boost::optional> added) {} virtual void SetBestChain(const CBlockLocator &locator) {} virtual void UpdatedTransaction(const uint256 &hash) {} - virtual void Inventory(const uint256 &hash) {} virtual void ResendWalletTransactions(int64_t nBestBlockTime) {} virtual void BlockChecked(const CBlock&, const CValidationState&) {} - virtual void ResetRequestCount(const uint256 &hash) {}; friend void ::RegisterValidationInterface(CValidationInterface*); friend void ::UnregisterValidationInterface(CValidationInterface*); friend void ::UnregisterAllValidationInterfaces(); @@ -64,8 +62,6 @@ struct CMainSignals { boost::signals2::signal>)> ChainTip; /** Notifies listeners of a new active block chain. */ boost::signals2::signal SetBestChain; - /** Notifies listeners about an inventory item being seen on the network. */ - boost::signals2::signal Inventory; /** Tells listeners to broadcast their data. */ boost::signals2::signal Broadcast; /** Notifies listeners of a block validation result */ diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5cec332fc..75ca325d0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4043,9 +4043,6 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) delete pwalletdb; } - // Track how many getdata requests our transaction gets - mapRequestCount[wtxNew.GetHash()] = 0; - std::string strCmd = GetArg("-txsend", ""); if (fBroadcastTransactions) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index b2d29d3f9..c3c105b71 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1016,7 +1016,6 @@ public: std::map mapWallet; int64_t nOrderPosNext; - std::map mapRequestCount; std::map mapAddressBook; @@ -1235,22 +1234,7 @@ public: void UpdatedTransaction(const uint256 &hashTx); - void Inventory(const uint256 &hash) - { - { - LOCK(cs_wallet); - std::map::iterator mi = mapRequestCount.find(hash); - if (mi != mapRequestCount.end()) - (*mi).second++; - } - } - //void GetScriptForMining(boost::shared_ptr &script); - void ResetRequestCount(const uint256 &hash) - { - LOCK(cs_wallet); - mapRequestCount[hash] = 0; - }; unsigned int GetKeyPoolSize() {