MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / AbortPrivateBroadcast

Method AbortPrivateBroadcast

src/net_processing.cpp:1887–1906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1885}
1886
1887std::vector<CTransactionRef> PeerManagerImpl::AbortPrivateBroadcast(const uint256& id)
1888{
1889 const auto snapshot{m_tx_for_private_broadcast.GetBroadcastInfo()};
1890 std::vector<CTransactionRef> removed_txs;
1891
1892 size_t connections_cancelled{0};
1893 for (const auto& tx_info : snapshot) {
1894 const CTransactionRef& tx{tx_info.tx};
1895 if (tx->GetHash().ToUint256() != id && tx->GetWitnessHash().ToUint256() != id) continue;
1896 if (const auto peer_acks{m_tx_for_private_broadcast.Remove(tx)}) {
1897 removed_txs.push_back(tx);
1898 if (NUM_PRIVATE_BROADCAST_PER_TX > *peer_acks) {
1899 connections_cancelled += (NUM_PRIVATE_BROADCAST_PER_TX - *peer_acks);
1900 }
1901 }
1902 }
1903 m_connman.m_private_broadcast.NumToOpenSub(connections_cancelled);
1904
1905 return removed_txs;
1906}
1907
1908void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx)
1909{

Callers 1

abortprivatebroadcastFunction · 0.80

Calls 4

RemoveMethod · 0.80
NumToOpenSubMethod · 0.80
GetHashMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected