mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-10 14:03:17 +02:00
scripted-diff: Rename touched member variables
-BEGIN VERIFY SCRIPT-
ren() { sed -i "s/\<$1\>/$2/g" $( git grep -l "$1" ./src/ ) ; }
ren nLastBlockTime m_last_block_time
ren nLastTXTime m_last_tx_time
ren nTimeConnected m_connected
-END VERIFY SCRIPT-
This commit is contained in:
@@ -2511,7 +2511,7 @@ void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlo
|
||||
bool new_block{false};
|
||||
m_chainman.ProcessNewBlock(m_chainparams, block, force_processing, &new_block);
|
||||
if (new_block) {
|
||||
node.nLastBlockTime = GetTime<std::chrono::seconds>();
|
||||
node.m_last_block_time = GetTime<std::chrono::seconds>();
|
||||
} else {
|
||||
LOCK(cs_main);
|
||||
mapBlockSource.erase(block->GetHash());
|
||||
@@ -3314,7 +3314,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
_RelayTransaction(tx.GetHash(), tx.GetWitnessHash());
|
||||
m_orphanage.AddChildrenToWorkSet(tx, peer->m_orphan_work_set);
|
||||
|
||||
pfrom.nLastTXTime = GetTime<std::chrono::seconds>();
|
||||
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>();
|
||||
|
||||
LogPrint(BCLog::MEMPOOL, "AcceptToMemoryPool: peer=%d: accepted %s (poolsz %u txn, %u kB)\n",
|
||||
pfrom.GetId(),
|
||||
@@ -4244,7 +4244,7 @@ void PeerManagerImpl::EvictExtraOutboundPeers(std::chrono::seconds now)
|
||||
if (pnode->GetId() > youngest_peer.first) {
|
||||
next_youngest_peer = youngest_peer;
|
||||
youngest_peer.first = pnode->GetId();
|
||||
youngest_peer.second = pnode->nLastBlockTime;
|
||||
youngest_peer.second = pnode->m_last_block_time;
|
||||
}
|
||||
});
|
||||
NodeId to_disconnect = youngest_peer.first;
|
||||
@@ -4262,14 +4262,14 @@ void PeerManagerImpl::EvictExtraOutboundPeers(std::chrono::seconds now)
|
||||
// valid headers chain with at least as much work as our tip.
|
||||
CNodeState *node_state = State(pnode->GetId());
|
||||
if (node_state == nullptr ||
|
||||
(now - pnode->nTimeConnected >= MINIMUM_CONNECT_TIME && node_state->nBlocksInFlight == 0)) {
|
||||
(now - pnode->m_connected >= MINIMUM_CONNECT_TIME && node_state->nBlocksInFlight == 0)) {
|
||||
pnode->fDisconnect = true;
|
||||
LogPrint(BCLog::NET, "disconnecting extra block-relay-only peer=%d (last block received at time %d)\n",
|
||||
pnode->GetId(), count_seconds(pnode->nLastBlockTime));
|
||||
pnode->GetId(), count_seconds(pnode->m_last_block_time));
|
||||
return true;
|
||||
} else {
|
||||
LogPrint(BCLog::NET, "keeping block-relay-only peer=%d chosen for eviction (connect time: %d, blocks_in_flight: %d)\n",
|
||||
pnode->GetId(), count_seconds(pnode->nTimeConnected), node_state->nBlocksInFlight);
|
||||
pnode->GetId(), count_seconds(pnode->m_connected), node_state->nBlocksInFlight);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -4309,13 +4309,13 @@ void PeerManagerImpl::EvictExtraOutboundPeers(std::chrono::seconds now)
|
||||
// Also don't disconnect any peer we're trying to download a
|
||||
// block from.
|
||||
CNodeState &state = *State(pnode->GetId());
|
||||
if (now - pnode->nTimeConnected > MINIMUM_CONNECT_TIME && state.nBlocksInFlight == 0) {
|
||||
if (now - pnode->m_connected > MINIMUM_CONNECT_TIME && state.nBlocksInFlight == 0) {
|
||||
LogPrint(BCLog::NET, "disconnecting extra outbound peer=%d (last block announcement received at time %d)\n", pnode->GetId(), oldest_block_announcement);
|
||||
pnode->fDisconnect = true;
|
||||
return true;
|
||||
} else {
|
||||
LogPrint(BCLog::NET, "keeping outbound peer=%d chosen for eviction (connect time: %d, blocks_in_flight: %d)\n",
|
||||
pnode->GetId(), count_seconds(pnode->nTimeConnected), state.nBlocksInFlight);
|
||||
pnode->GetId(), count_seconds(pnode->m_connected), state.nBlocksInFlight);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -4567,7 +4567,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
|
||||
const auto current_time = GetTime<std::chrono::microseconds>();
|
||||
|
||||
if (pto->IsAddrFetchConn() && current_time - pto->nTimeConnected > 10 * AVG_ADDRESS_BROADCAST_INTERVAL) {
|
||||
if (pto->IsAddrFetchConn() && current_time - pto->m_connected > 10 * AVG_ADDRESS_BROADCAST_INTERVAL) {
|
||||
LogPrint(BCLog::NET, "addrfetch connection timeout; disconnecting peer=%d\n", pto->GetId());
|
||||
pto->fDisconnect = true;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user