-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore!: merge bitcoin#28753, partial bitcoin#28195 (bump MIN_PEER_PROTO_VERSION
to 70221
)
#6877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8d13227
1d39829
5d9435d
8c141f8
4096d77
c5bfb57
3562045
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
P2P and Network Changes | ||
----------------------- | ||
|
||
`MIN_PEER_PROTO_VERSION` has been bumped to `70221` |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -650,13 +650,13 @@ class PeerManagerImpl final : public PeerManager | |||||||||||||||||||||||||
void AskPeersForTransaction(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
/** Relay inventories to peers that find it relevant */ | ||||||||||||||||||||||||||
void RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx, const int minProtoVersion) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); | ||||||||||||||||||||||||||
void RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||
* This overload will not update node filters, use it only for the cases | ||||||||||||||||||||||||||
* when other messages will update related transaction data in filters | ||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||
void RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash, const int minProtoVersion) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); | ||||||||||||||||||||||||||
void RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
void EraseObjectRequest(NodeId nodeid, const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -2402,15 +2402,15 @@ void PeerManagerImpl::RelayDSQ(const CCoinJoinQueue& queue) | |||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx, const int minProtoVersion) | ||||||||||||||||||||||||||
void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx) | ||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||
// TODO: Migrate to iteration through m_peer_map | ||||||||||||||||||||||||||
m_connman.ForEachNode([&](CNode* pnode) { | ||||||||||||||||||||||||||
PeerRef peer = GetPeerRef(pnode->GetId()); | ||||||||||||||||||||||||||
if (peer == nullptr) return; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
auto tx_relay = peer->GetTxRelay(); | ||||||||||||||||||||||||||
if (pnode->nVersion < minProtoVersion || !pnode->CanRelay() || tx_relay == nullptr) { | ||||||||||||||||||||||||||
if (!pnode->CanRelay() || tx_relay == nullptr) { | ||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -2427,15 +2427,15 @@ void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const CTransaction& rela | |||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash, const int minProtoVersion) | ||||||||||||||||||||||||||
void PeerManagerImpl::RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash) | ||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||
// TODO: Migrate to iteration through m_peer_map | ||||||||||||||||||||||||||
m_connman.ForEachNode([&](CNode* pnode) { | ||||||||||||||||||||||||||
PeerRef peer = GetPeerRef(pnode->GetId()); | ||||||||||||||||||||||||||
if (peer == nullptr) return; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
auto tx_relay = peer->GetTxRelay(); | ||||||||||||||||||||||||||
if (pnode->nVersion < minProtoVersion || !pnode->CanRelay() || tx_relay == nullptr) { | ||||||||||||||||||||||||||
if (!pnode->CanRelay() || tx_relay == nullptr) { | ||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -3525,9 +3525,9 @@ void PeerManagerImpl::PostProcessMessage(MessageProcessingResult&& result, NodeI | |||||||||||||||||||||||||
if (result.m_inv_filter) { | ||||||||||||||||||||||||||
const auto& [inv, filter] = result.m_inv_filter.value(); | ||||||||||||||||||||||||||
if (std::holds_alternative<CTransactionRef>(filter)) { | ||||||||||||||||||||||||||
RelayInvFiltered(inv, *std::get<CTransactionRef>(filter), ISDLOCK_PROTO_VERSION); | ||||||||||||||||||||||||||
RelayInvFiltered(inv, *std::get<CTransactionRef>(filter)); | ||||||||||||||||||||||||||
} else if (std::holds_alternative<uint256>(filter)) { | ||||||||||||||||||||||||||
RelayInvFiltered(inv, std::get<uint256>(filter), ISDLOCK_PROTO_VERSION); | ||||||||||||||||||||||||||
RelayInvFiltered(inv, std::get<uint256>(filter)); | ||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||
Comment on lines
+3528
to
3531
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Avoid potential null dereference of CTransactionRef. std::get(filter) can be empty; dereferencing would crash. Guard it. - RelayInvFiltered(inv, *std::get<CTransactionRef>(filter));
+ const auto& txref = std::get<CTransactionRef>(filter);
+ if (txref) {
+ RelayInvFiltered(inv, *txref);
+ } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||
assert(false); | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
@@ -6211,7 +6211,6 @@ bool PeerManagerImpl::SendMessages(CNode* pto) | |||||||||||||||||||||||||
|
||||||||||||||||||||||||||
const auto islock = m_llmq_ctx->isman->GetInstantSendLockByTxid(hash); | ||||||||||||||||||||||||||
if (islock == nullptr) continue; | ||||||||||||||||||||||||||
if (pto->nVersion < ISDLOCK_PROTO_VERSION) continue; | ||||||||||||||||||||||||||
uint256 isLockHash{::SerializeHash(*islock)}; | ||||||||||||||||||||||||||
tx_relay->m_tx_inventory_known_filter.insert(isLockHash); | ||||||||||||||||||||||||||
queueAndMaybePushInv(CInv(MSG_ISDLOCK, isLockHash)); | ||||||||||||||||||||||||||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.