mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
protocol: don't stem transactions to peers who don't relay blocks
This commit is contained in:
parent
e2f8b6ee41
commit
24ee768d4f
1 changed files with 7 additions and 7 deletions
|
@ -106,7 +106,7 @@ namespace levin
|
|||
}
|
||||
|
||||
//! \return Outgoing connections supporting fragments in `connections` filtered by remote blockchain height.
|
||||
std::vector<boost::uuids::uuid> get_out_connections(connections& p2p, uint64_t min_blockchain_height)
|
||||
std::vector<boost::uuids::uuid> get_out_connections(connections& p2p, uint64_t min_blockchain_height, int64_t min_score)
|
||||
{
|
||||
std::vector<boost::uuids::uuid> outs;
|
||||
outs.reserve(connection_id_reserve_size);
|
||||
|
@ -115,8 +115,8 @@ namespace levin
|
|||
the reserve call so a strand is not used. Investigate if there is lots
|
||||
of waiting in here. */
|
||||
|
||||
p2p.foreach_connection([&outs, min_blockchain_height] (detail::p2p_context& context) {
|
||||
if (!context.m_is_income && context.m_remote_blockchain_height >= min_blockchain_height)
|
||||
p2p.foreach_connection([&outs, min_blockchain_height, min_score] (detail::p2p_context& context) {
|
||||
if (!context.m_is_income && context.m_remote_blockchain_height >= min_blockchain_height && context.m_score >= min_score)
|
||||
outs.emplace_back(context.m_connection_id);
|
||||
return true;
|
||||
});
|
||||
|
@ -544,7 +544,7 @@ namespace levin
|
|||
}
|
||||
|
||||
// connection list may be outdated, try again
|
||||
update_channels::run(zone_, get_out_connections(*zone_->p2p, core_->get_target_blockchain_height()));
|
||||
update_channels::run(zone_, get_out_connections(*zone_->p2p, core_->get_target_blockchain_height(), 0));
|
||||
}
|
||||
|
||||
MERROR("Unable to send transaction(s) via Dandelion++ stem");
|
||||
|
@ -646,7 +646,7 @@ namespace levin
|
|||
channel.active = nullptr;
|
||||
channel.connection = boost::uuids::nil_uuid();
|
||||
|
||||
auto connections = get_out_connections(*zone_->p2p, core_->get_target_blockchain_height());
|
||||
auto connections = get_out_connections(*zone_->p2p, core_->get_target_blockchain_height(), 0);
|
||||
if (connections.empty())
|
||||
MWARNING("Lost all outbound connections to anonymity network - currently unable to send transaction(s)");
|
||||
|
||||
|
@ -679,7 +679,7 @@ namespace levin
|
|||
|
||||
const bool fluffing = crypto::rand_idx(unsigned(100)) < CRYPTONOTE_DANDELIONPP_FLUFF_PROBABILITY;
|
||||
const auto start = std::chrono::steady_clock::now();
|
||||
auto connections = get_out_connections(*(zone_->p2p), core_->get_target_blockchain_height());
|
||||
auto connections = get_out_connections(*(zone_->p2p), core_->get_target_blockchain_height(), 0);
|
||||
zone_->strand.dispatch(
|
||||
change_channels{zone_, net::dandelionpp::connection_map{std::move(connections), count_}, fluffing}
|
||||
);
|
||||
|
@ -730,7 +730,7 @@ namespace levin
|
|||
return;
|
||||
|
||||
zone_->strand.dispatch(
|
||||
update_channels{zone_, get_out_connections(*(zone_->p2p), core_->get_target_blockchain_height())}
|
||||
update_channels{zone_, get_out_connections(*(zone_->p2p), core_->get_target_blockchain_height(), 0)}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue