Skip to content

Commit 2f75401

Browse files
committed
Log when proposals are processed by the job queue.
Log peer position counts when evaluating consensus. Correlate tx set/proposal with built ledger.
1 parent 5288dc3 commit 2f75401

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

src/xrpld/app/consensus/RCLConsensus.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ RCLConsensus::Adaptor::doAccept(
539539

540540
auto const newLCLHash = built.id();
541541
JLOG(j_.debug()) << "Built ledger #" << built.seq() << ": " << newLCLHash;
542+
JLOG(j_.debug()) << "built ledger " << built.seq() << ": " << newLCLHash
543+
<< " base on position " << result.position.position();
542544

543545
// Tell directly connected peers that we have a new LCL
544546
notify(protocol::neACCEPTED_LEDGER, built, haveCorrectLCL);

src/xrpld/consensus/Consensus.h

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,14 @@ Consensus<Adaptor>::timerEntry(
851851
return;
852852
}
853853

854+
std::optional<typename TxSet_t::ID> startPosition;
855+
if (result_) {
856+
startPosition = result_->position.position();
857+
CLOG(clog) << "start position " << *startPosition << ". ";
858+
} else {
859+
CLOG(clog) << "no start position. ";
860+
}
861+
854862
now_ = now;
855863
CLOG(clog) << "Set network adjusted time to " << to_string(now) << ". ";
856864

@@ -867,6 +875,18 @@ Consensus<Adaptor>::timerEntry(
867875
phaseOpen(clog);
868876
else if (phase_ == ConsensusPhase::establish)
869877
phaseEstablish(clog);
878+
879+
if (result_) {
880+
if (startPosition == result_->position.position())
881+
CLOG(clog) << "no position change. ";
882+
else
883+
CLOG(clog) << "position change to " << result_->position.position() << ". ";
884+
} else if (startPosition.has_value()) {
885+
CLOG(clog) << "position change to no value. ";
886+
} else {
887+
CLOG(clog) << "no position change. ";
888+
}
889+
870890
CLOG(clog) << "timerEntry finishing in phase " << to_string(phase_) << ". ";
871891
}
872892

@@ -1492,6 +1512,7 @@ Consensus<Adaptor>::updateOurPositions(
14921512
// peer's proposal is stale, so remove it
14931513
NodeID_t const& peerID = peerProp.nodeID();
14941514
JLOG(j_.warn()) << "Removing stale proposal from " << peerID;
1515+
CLOG(clog) << "Removing stale proposal from " << peerID << ". ";
14951516
for (auto& dt : result_->disputes)
14961517
dt.second.unVote(peerID);
14971518
it = currPeerPositions_.erase(it);
@@ -1505,6 +1526,18 @@ Consensus<Adaptor>::updateOurPositions(
15051526
}
15061527
}
15071528

1529+
if (currPeerPositions_.empty()) {
1530+
CLOG(clog) << "no peer positions. ";
1531+
} else {
1532+
std::map<typename TxSet_t::ID, int> peerPositionCounts;
1533+
for (auto const& [_, pos] : currPeerPositions_)
1534+
++peerPositionCounts[pos.proposal().position()];
1535+
CLOG(clog) << "peer positions,counts: ";
1536+
for (auto const& [pos, count] : peerPositionCounts)
1537+
CLOG(clog) << pos << ',' << count << ';';
1538+
CLOG(clog) << ". ";
1539+
}
1540+
15081541
// This will stay unseated unless there are any changes
15091542
std::optional<TxSet_t> ourNewSet;
15101543

@@ -1548,6 +1581,7 @@ Consensus<Adaptor>::updateOurPositions(
15481581
// no other times
15491582
haveCloseTimeConsensus_ = true;
15501583
consensusCloseTime = asCloseTime(result_->position.closeTime());
1584+
CLOG(clog) << " no peer positions. ";
15511585
}
15521586
else
15531587
{
@@ -1586,11 +1620,14 @@ Consensus<Adaptor>::updateOurPositions(
15861620

15871621
for (auto const& [t, v] : closeTimeVotes)
15881622
{
1589-
JLOG(j_.debug())
1623+
std::stringstream ss2;
1624+
ss2
15901625
<< "CCTime: seq "
15911626
<< static_cast<std::uint32_t>(previousLedger_.seq()) + 1 << ": "
15921627
<< t.time_since_epoch().count() << " has " << v << ", "
15931628
<< threshVote << " required";
1629+
CLOG(clog) << ss2.str();
1630+
JLOG(j_.debug()) << ss2.str();
15941631

15951632
if (v >= threshVote)
15961633
{
@@ -1631,7 +1668,7 @@ Consensus<Adaptor>::updateOurPositions(
16311668

16321669
std::stringstream ss;
16331670
ss << "Position change: CTime "
1634-
<< consensusCloseTime.time_since_epoch().count() << ", tx " << newID;
1671+
<< consensusCloseTime.time_since_epoch().count() << ", tx " << newID << " . ";
16351672
JLOG(j_.info()) << ss.str();
16361673
CLOG(clog) << ss.str();
16371674

src/xrpld/overlay/detail/PeerImp.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,15 +2929,17 @@ PeerImp::checkPropose(
29292929
std::shared_ptr<protocol::TMProposeSet> const& packet,
29302930
RCLCxPeerPos peerPos)
29312931
{
2932-
JLOG(p_journal_.trace())
2933-
<< "Checking " << (isTrusted ? "trusted" : "UNTRUSTED") << " proposal";
2932+
JLOG(p_journal_.debug())
2933+
<< "Checking " << (isTrusted ? "trusted" : "UNTRUSTED") << " proposal: "
2934+
<< peerPos.proposal().position() << " from "
2935+
<< peerPos.proposal().nodeID();
29342936

29352937
XRPL_ASSERT(packet, "ripple::PeerImp::checkPropose : non-null packet");
29362938

29372939
if (!cluster() && !peerPos.checkSign())
29382940
{
29392941
std::string desc{"Proposal fails sig check"};
2940-
JLOG(p_journal_.warn()) << desc;
2942+
JLOG(p_journal_.warn()) << desc << " " << peerPos.proposal().position();
29412943
charge(Resource::feeInvalidSignature, desc);
29422944
return;
29432945
}

0 commit comments

Comments
 (0)