Skip to content

Commit 3511ad7

Browse files
Mark TravisMark Travis
authored andcommitted
Log proposals and validations.
1 parent 8458233 commit 3511ad7

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed

include/xrpl/protocol/STValidation.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <functional>
3131
#include <memory>
3232
#include <optional>
33+
#include <sstream>
3334

3435
namespace ripple {
3536

@@ -141,6 +142,25 @@ class STValidation final : public STObject, public CountedObject<STValidation>
141142
Blob
142143
getSignature() const;
143144

145+
std::string
146+
render() const
147+
{
148+
std::stringstream ss;
149+
ss << "validation: "
150+
<< " ledger_hash: " << getLedgerHash()
151+
<< " consensus_hash: " << getConsensusHash()
152+
<< " sign_time: " << to_string(getSignTime())
153+
<< " seen_time: " << to_string(getSeenTime())
154+
<< " signer_public_key: " << getSignerPublic()
155+
<< " node_id: " << getNodeID()
156+
<< " is_valid: " << isValid()
157+
<< " is_full: " << isFull()
158+
<< " is_trusted: " << isTrusted()
159+
<< " signing_hash: " << getSigningHash()
160+
<< " base58: " << toBase58(TokenType::NodePublic, getSignerPublic());
161+
return ss.str();
162+
}
163+
144164
private:
145165
static SOTemplate const&
146166
validationFormat();

src/test/csf/Peer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ struct Peer
7777
return proposal_.getJson();
7878
}
7979

80+
std::string
81+
render() const
82+
{
83+
return "";
84+
}
85+
8086
private:
8187
Proposal proposal_;
8288
};

src/xrpld/app/consensus/RCLCxPeerPos.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ class RCLCxPeerPos
9797
Json::Value
9898
getJson() const;
9999

100+
std::string
101+
render() const
102+
{
103+
return proposal_.render();
104+
}
105+
100106
private:
101107
PublicKey publicKey_;
102108
uint256 suppression_;

src/xrpld/app/misc/NetworkOPs.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,6 +2333,18 @@ NetworkOPsImp::recvValidation(
23332333
lock.unlock();
23342334

23352335
pubValidation(val);
2336+
std::stringstream ss;
2337+
ss << "VALIDATION: " << val->render() << " master_key: ";
2338+
auto master = app_.validators().getTrustedKey(val->getSignerPublic());
2339+
if (master)
2340+
{
2341+
ss << toBase58(TokenType::NodePublic, *master);
2342+
}
2343+
else
2344+
{
2345+
ss << "none";
2346+
}
2347+
JLOG(m_journal.debug()) << ss.str();
23362348

23372349
// We will always relay trusted validations; if configured, we will
23382350
// also relay all untrusted validations.

src/xrpld/consensus/Consensus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ Consensus<Adaptor>::peerProposal(
704704
NetClock::time_point const& now,
705705
PeerPosition_t const& newPeerPos)
706706
{
707+
JLOG(j_.debug()) << "PROPOSAL " << newPeerPos.render();
707708
auto const& peerID = newPeerPos.proposal().nodeID();
708709

709710
// Always need to store recent positions

src/xrpld/consensus/ConsensusProposal.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <xrpl/protocol/HashPrefix.h>
2626
#include <xrpl/protocol/jss.h>
2727
#include <cstdint>
28+
#include <sstream>
2829
#include <optional>
2930

3031
namespace ripple {
@@ -194,6 +195,20 @@ class ConsensusProposal
194195
proposeSeq_ = seqLeave;
195196
}
196197

198+
std::string
199+
render() const
200+
{
201+
std::stringstream ss;
202+
ss << "proposal: previous_ledger: " << previousLedger_
203+
<< " proposal_seq: " << proposeSeq_
204+
<< " position: " << position_
205+
<< " close_time: " << to_string(closeTime_)
206+
<< " now: " << to_string(time_)
207+
<< " is_bow_out:" << isBowOut()
208+
<< " node_id: " << nodeID_;
209+
return ss.str();
210+
}
211+
197212
//! Get JSON representation for debugging
198213
Json::Value
199214
getJson() const

0 commit comments

Comments
 (0)