fix(consensus): stop serving sidecars when reconciliation is off

This commit is contained in:
Nicholas Dudfield
2026-07-01 11:30:42 +07:00
parent d4650441fb
commit e8fa4e1154
2 changed files with 23 additions and 6 deletions

View File

@@ -1977,12 +1977,22 @@ NetworkOPsImp::mapComplete(std::shared_ptr<SHAMap> const& map, bool fromAcquire)
// either created locally during the consensus process
// or acquired from a peer
// Inform peers we have this set
protocol::TMHaveTransactionSet msg;
msg.set_hash(map->getHash().as_uint256().begin(), 256 / 8);
msg.set_status(protocol::tsHAVE);
app_.overlay().foreach(
send_always(std::make_shared<Message>(msg, protocol::mtHAVE_SET)));
// Inform peers we have this set. When sidecar reconciliation is compiled
// out, sidecar SHAMaps remain local consensus inputs; do not expose them
// through the generic candidate-set availability path.
#if XAHAUD_ENABLE_SIDECAR_RECONCILIATION
bool const advertiseSet = true;
#else
bool const advertiseSet = map->mapType() != SHAMapType::SIDECAR;
#endif
if (advertiseSet)
{
protocol::TMHaveTransactionSet msg;
msg.set_hash(map->getHash().as_uint256().begin(), 256 / 8);
msg.set_status(protocol::tsHAVE);
app_.overlay().foreach(
send_always(std::make_shared<Message>(msg, protocol::mtHAVE_SET)));
}
// We acquired it because consensus asked us to
if (fromAcquire)

View File

@@ -3318,6 +3318,13 @@ PeerImp::getTxSet(std::shared_ptr<protocol::TMGetLedger> const& m) const
uint256 const txSetHash{m->ledgerhash()};
std::shared_ptr<SHAMap> shaMap{
app_.getInboundTransactions().getSet(txSetHash, false)};
#if !XAHAUD_ENABLE_SIDECAR_RECONCILIATION
if (shaMap && shaMap->mapType() == SHAMapType::SIDECAR)
{
JLOG(p_journal_.debug()) << "getTxSet: Sidecar set serving disabled";
return {};
}
#endif
if (!shaMap)
{
if (m->has_querytype() && !m->has_requestcookie())