Merge remote-tracking branch 'remove-mapRequest' into hotfix-5.3.3
This commit is contained in:
commit
f30c3c97b7
|
@ -6395,9 +6395,6 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
|
|||
}
|
||||
}
|
||||
|
||||
// Track requests for our stuff.
|
||||
GetMainSignals().Inventory(inv.hash);
|
||||
|
||||
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
|
||||
break;
|
||||
}
|
||||
|
@ -6764,9 +6761,6 @@ bool static ProcessMessage(const CChainParams& chainparams, CNode* pfrom, string
|
|||
pfrom->AskFor(inv);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
|
|
@ -877,9 +877,6 @@ static bool ProcessBlockFound(const CBlock* pblock, const CChainParams& chainpar
|
|||
return error("ZcashMiner: generated block is stale");
|
||||
}
|
||||
|
||||
// Inform about the new block
|
||||
GetMainSignals().BlockFound(pblock->GetHash());
|
||||
|
||||
// Process this block the same as if we had received it from another node
|
||||
CValidationState state;
|
||||
if (!ProcessNewBlock(state, chainparams, NULL, pblock, true, NULL))
|
||||
|
|
|
@ -37,19 +37,15 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
|||
g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1));
|
||||
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
||||
g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3));
|
||||
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.AddressForMining.connect(boost::bind(&CValidationInterface::GetAddressForMining, 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.AddressForMining.disconnect(boost::bind(&CValidationInterface::GetAddressForMining, 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.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
||||
g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1));
|
||||
|
@ -59,11 +55,9 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
|||
}
|
||||
|
||||
void UnregisterAllValidationInterfaces() {
|
||||
g_signals.BlockFound.disconnect_all_slots();
|
||||
g_signals.AddressForMining.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.UpdatedTransaction.disconnect_all_slots();
|
||||
g_signals.EraseTransaction.disconnect_all_slots();
|
||||
|
|
|
@ -92,11 +92,9 @@ protected:
|
|||
virtual void EraseFromWallet(const uint256 &hash) {}
|
||||
virtual void ChainTip(const CBlockIndex *pindex, const CBlock *pblock, std::optional<MerkleFrontiers> added) {}
|
||||
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 GetAddressForMining(std::optional<MinerAddress>&) {};
|
||||
virtual void ResetRequestCount(const uint256 &hash) {};
|
||||
friend void ::RegisterValidationInterface(CValidationInterface*);
|
||||
friend void ::UnregisterValidationInterface(CValidationInterface*);
|
||||
friend void ::UnregisterAllValidationInterfaces();
|
||||
|
@ -160,16 +158,12 @@ struct CMainSignals {
|
|||
boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
|
||||
/** Notifies listeners of a change to the tip of the active block chain. */
|
||||
boost::signals2::signal<void (const CBlockIndex *, const CBlock *, std::optional<MerkleFrontiers>)> ChainTip;
|
||||
/** Notifies listeners about an inventory item being seen on the network. */
|
||||
boost::signals2::signal<void (const uint256 &)> Inventory;
|
||||
/** Tells listeners to broadcast their data. */
|
||||
boost::signals2::signal<void (int64_t nBestBlockTime)> Broadcast;
|
||||
/** Notifies listeners of a block validation result */
|
||||
boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
|
||||
/** Notifies listeners that an address for mining is required (coinbase) */
|
||||
boost::signals2::signal<void (std::optional<MinerAddress>&)> AddressForMining;
|
||||
/** Notifies listeners that a block has been successfully mined */
|
||||
boost::signals2::signal<void (const uint256 &)> BlockFound;
|
||||
};
|
||||
|
||||
CMainSignals& GetMainSignals();
|
||||
|
|
|
@ -4455,45 +4455,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 (!hashBlock.IsNull())
|
||||
{
|
||||
map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(hashBlock);
|
||||
if (mi != pwallet->mapRequestCount.end())
|
||||
nRequests = (*mi).second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Did anyone request this transaction?
|
||||
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 && !hashBlock.IsNull())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
// GetAmounts will determine the transparent debits and credits for a given wallet tx.
|
||||
void CWalletTx::GetAmounts(std::list<COutputEntry>& listReceived,
|
||||
std::list<COutputEntry>& listSent, CAmount& nFee, const isminefilter& filter) const
|
||||
|
@ -5914,9 +5875,6 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, std::optional<std::reference_
|
|||
delete pwalletdb;
|
||||
}
|
||||
|
||||
// Track how many getdata requests our transaction gets
|
||||
mapRequestCount[wtxNew.GetHash()] = 0;
|
||||
|
||||
if (fBroadcastTransactions)
|
||||
{
|
||||
// Broadcast
|
||||
|
|
|
@ -691,7 +691,6 @@ public:
|
|||
bool IsTrusted(const std::optional<int>& asOfHeight) const;
|
||||
|
||||
int64_t GetTxTime() const;
|
||||
int GetRequestCount() const;
|
||||
|
||||
bool RelayWalletTransaction();
|
||||
|
||||
|
@ -1416,7 +1415,6 @@ public:
|
|||
TxItems wtxOrdered;
|
||||
|
||||
int64_t nOrderPosNext;
|
||||
std::map<uint256, int> mapRequestCount;
|
||||
|
||||
std::map<CTxDestination, CAddressBookData> mapAddressBook;
|
||||
|
||||
|
@ -1971,22 +1969,7 @@ public:
|
|||
|
||||
void UpdatedTransaction(const uint256 &hashTx);
|
||||
|
||||
void Inventory(const uint256 &hash)
|
||||
{
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
std::map<uint256, int>::iterator mi = mapRequestCount.find(hash);
|
||||
if (mi != mapRequestCount.end())
|
||||
(*mi).second++;
|
||||
}
|
||||
}
|
||||
|
||||
void GetAddressForMining(std::optional<MinerAddress> &minerAddress);
|
||||
void ResetRequestCount(const uint256 &hash)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
mapRequestCount[hash] = 0;
|
||||
};
|
||||
|
||||
unsigned int GetKeyPoolSize()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue