Skip to content

Commit 8b038a8

Browse files
committed
Remove dead code in Herder
1 parent a1541d6 commit 8b038a8

11 files changed

+15
-17
lines changed

src/herder/HerderImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ HerderImpl::broadcast(SCPEnvelope const& e)
504504
e.statement.slotIndex);
505505

506506
mSCPMetrics.mEnvelopeEmit.Mark();
507-
mApp.getOverlayManager().broadcastMessage(m, false);
507+
mApp.getOverlayManager().broadcastMessage(m);
508508
}
509509
}
510510

src/herder/TransactionQueue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ TransactionQueue::broadcastTx(AccountState& state, TimestampedTx& tx)
11151115
return BroadcastStatus::BROADCAST_STATUS_SKIPPED;
11161116
}
11171117
return mApp.getOverlayManager().broadcastMessage(
1118-
tx.mTx->toStellarMessage(), false,
1118+
tx.mTx->toStellarMessage(),
11191119
std::make_optional<Hash>(tx.mTx->getFullHash()))
11201120
? BroadcastStatus::BROADCAST_STATUS_SUCCESS
11211121
: BroadcastStatus::BROADCAST_STATUS_ALREADY;

src/overlay/Floodgate.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ Floodgate::addRecord(StellarMessage const& msg, Peer::pointer peer, Hash& index)
8585

8686
// send message to anyone you haven't gotten it from
8787
bool
88-
Floodgate::broadcast(StellarMessage const& msg, bool force,
89-
std::optional<Hash> const& hash)
88+
Floodgate::broadcast(StellarMessage const& msg, std::optional<Hash> const& hash)
9089
{
9190
ZoneScoped;
9291
if (mShuttingDown)
@@ -102,7 +101,7 @@ Floodgate::broadcast(StellarMessage const& msg, bool force,
102101

103102
FloodRecord::pointer fr;
104103
auto result = mFloodMap.find(index);
105-
if (result == mFloodMap.end() || force)
104+
if (result == mFloodMap.end())
106105
{ // no one has sent us this message / start from scratch
107106
fr = std::make_shared<FloodRecord>(
108107
mApp.getHerder().trackingConsensusLedgerIndex(), Peer::pointer());

src/overlay/Floodgate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Floodgate
6060

6161
// returns true if msg was sent to at least one peer
6262
// The hash required for transactions
63-
bool broadcast(StellarMessage const& msg, bool force,
63+
bool broadcast(StellarMessage const& msg,
6464
std::optional<Hash> const& hash = std::nullopt);
6565

6666
// returns the list of peers that sent us the item with hash `msgID`

src/overlay/OverlayManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class OverlayManager
7777
// When passing a transaction message,
7878
// the hash of TransactionEnvelope must be passed also for pull mode.
7979
virtual bool
80-
broadcastMessage(StellarMessage const& msg, bool force = false,
80+
broadcastMessage(StellarMessage const& msg,
8181
std::optional<Hash> const hash = std::nullopt) = 0;
8282

8383
// Make a note in the FloodGate that a given peer has provided us with a

src/overlay/OverlayManagerImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1151,11 +1151,11 @@ OverlayManagerImpl::forgetFloodedMsg(Hash const& msgID)
11511151
}
11521152

11531153
bool
1154-
OverlayManagerImpl::broadcastMessage(StellarMessage const& msg, bool force,
1154+
OverlayManagerImpl::broadcastMessage(StellarMessage const& msg,
11551155
std::optional<Hash> const hash)
11561156
{
11571157
ZoneScoped;
1158-
auto res = mFloodGate.broadcast(msg, force, hash);
1158+
auto res = mFloodGate.broadcast(msg, hash);
11591159
if (res)
11601160
{
11611161
mOverlayMetrics.mMessagesBroadcast.Mark();

src/overlay/OverlayManagerImpl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class OverlayManagerImpl : public OverlayManager
139139
Hash& msgID) override;
140140
void forgetFloodedMsg(Hash const& msgID) override;
141141
bool
142-
broadcastMessage(StellarMessage const& msg, bool force = false,
142+
broadcastMessage(StellarMessage const& msg,
143143
std::optional<Hash> const hash = std::nullopt) override;
144144
void connectTo(PeerBareAddress const& address) override;
145145

src/overlay/SurveyManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ SurveyManager::processTopologyRequest(SurveyRequestMessage const& request) const
345345
void
346346
SurveyManager::broadcast(StellarMessage const& msg) const
347347
{
348-
mApp.getOverlayManager().broadcastMessage(msg, false);
348+
mApp.getOverlayManager().broadcastMessage(msg);
349349
}
350350

351351
void

src/overlay/test/FloodTests.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ TEST_CASE("Flooding", "[flood][overlay][acceptance]")
160160
auto msg = tx1->toStellarMessage();
161161
auto res = inApp->getHerder().recvTransaction(tx1, false);
162162
REQUIRE(res == TransactionQueue::AddResult::ADD_STATUS_PENDING);
163-
inApp->getOverlayManager().broadcastMessage(msg, false,
163+
inApp->getOverlayManager().broadcastMessage(msg,
164164
tx1->getFullHash());
165165
};
166166

@@ -277,7 +277,7 @@ TEST_CASE("Flooding", "[flood][overlay][acceptance]")
277277
auto before =
278278
overlaytestutils::getAdvertisedHashCount(node);
279279
node->getOverlayManager().broadcastMessage(
280-
testTransaction->toStellarMessage(), false,
280+
testTransaction->toStellarMessage(),
281281
testTransaction->getFullHash());
282282
REQUIRE(before ==
283283
overlaytestutils::getAdvertisedHashCount(node));
@@ -301,7 +301,7 @@ TEST_CASE("Flooding", "[flood][overlay][acceptance]")
301301
auto before =
302302
overlaytestutils::getAdvertisedHashCount(node);
303303
node->getOverlayManager().broadcastMessage(
304-
testTransaction->toStellarMessage(), false,
304+
testTransaction->toStellarMessage(),
305305
testTransaction->getFullHash());
306306

307307
REQUIRE(before + 1 ==

src/overlay/test/OverlayManagerTests.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class OverlayManagerTests
295295
}
296296
}
297297
auto broadcastTxnMsg = [&](auto msg) {
298-
pm.broadcastMessage(msg, false, xdrSha256(msg.transaction()));
298+
pm.broadcastMessage(msg, xdrSha256(msg.transaction()));
299299
};
300300
broadcastTxnMsg(AtoB);
301301
crank(10);

src/simulation/LoadGenerator.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -2027,8 +2027,7 @@ LoadGenerator::execute(TransactionFramePtr& txf, LoadGenMode mode,
20272027
}
20282028
else
20292029
{
2030-
mApp.getOverlayManager().broadcastMessage(msg, false,
2031-
txf->getFullHash());
2030+
mApp.getOverlayManager().broadcastMessage(msg, txf->getFullHash());
20322031
}
20332032

20342033
return status;

0 commit comments

Comments
 (0)