Skip to content
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

Fix force broadcast in herder #2650

Merged
merged 2 commits into from Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/herder/HerderImpl.cpp
Expand Up @@ -515,8 +515,10 @@ HerderImpl::recvSCPEnvelope(SCPEnvelope const& envelope)
maxLedgerSeq = mHerderSCPDriver.nextConsensusLedgerIndex() +
LEDGER_VALIDITY_BRACKET;
}
else if (!checkCloseTime(envelope,
minLedgerSeq <= LedgerManager::GENESIS_LEDGER_SEQ))
else if (!checkCloseTime(
envelope,
(mHerderSCPDriver.lastTrackingSCP() == nullptr) &&
(minLedgerSeq <= LedgerManager::GENESIS_LEDGER_SEQ)))
{
// if we've never been in sync, we can be more aggressive in how we
// filter messages: we can ignore messages that are unlikely to be
Expand Down
13 changes: 9 additions & 4 deletions src/overlay/Floodgate.cpp
Expand Up @@ -92,16 +92,21 @@ Floodgate::broadcast(StellarMessage const& msg, bool force)
}
Hash index = sha256(xdr::xdr_to_opaque(msg));

FloodRecord::pointer fr;
auto result = mFloodMap.find(index);
if (result == mFloodMap.end() || force)
{ // no one has sent us this message
FloodRecord::pointer record = std::make_shared<FloodRecord>(
{ // no one has sent us this message / start from scratch
fr = std::make_shared<FloodRecord>(
msg, mApp.getHerder().getCurrentLedgerSeq(), Peer::pointer());
result = mFloodMap.insert(std::make_pair(index, record)).first;
mFloodMap[index] = fr;
mFloodMapSize.set_count(mFloodMap.size());
}
else
{
fr = result->second;
}
// send it to people that haven't sent it to us
auto& peersTold = result->second->mPeersTold;
auto& peersTold = fr->mPeersTold;

// make a copy, in case peers gets modified
auto peers = mApp.getOverlayManager().getAuthenticatedPeers();
Expand Down