diff --git a/include/xrpl/protocol/STValidation.h b/include/xrpl/protocol/STValidation.h index 32c60026fc..4f3e18de32 100644 --- a/include/xrpl/protocol/STValidation.h +++ b/include/xrpl/protocol/STValidation.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace ripple { @@ -141,6 +142,23 @@ public: Blob getSignature() const; + std::string + render() const + { + std::stringstream ss; + ss << "validation: " + << " ledger_hash: " << getLedgerHash() + << " consensus_hash: " << getConsensusHash() + << " sign_time: " << to_string(getSignTime()) + << " seen_time: " << to_string(getSeenTime()) + << " signer_public_key: " << getSignerPublic() + << " node_id: " << getNodeID() << " is_valid: " << isValid() + << " is_full: " << isFull() << " is_trusted: " << isTrusted() + << " signing_hash: " << getSigningHash() + << " base58: " << toBase58(TokenType::NodePublic, getSignerPublic()); + return ss.str(); + } + private: static SOTemplate const& validationFormat(); diff --git a/src/test/csf/Peer.h b/src/test/csf/Peer.h index 2f3b460e02..e6bc7d24e0 100644 --- a/src/test/csf/Peer.h +++ b/src/test/csf/Peer.h @@ -77,6 +77,12 @@ struct Peer return proposal_.getJson(); } + std::string + render() const + { + return ""; + } + private: Proposal proposal_; }; diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.h b/src/xrpld/app/consensus/RCLCxPeerPos.h index 4236e2ab12..b5d3d152cb 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.h +++ b/src/xrpld/app/consensus/RCLCxPeerPos.h @@ -97,6 +97,12 @@ public: Json::Value getJson() const; + std::string + render() const + { + return proposal_.render(); + } + private: PublicKey publicKey_; uint256 suppression_; diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index e526382df0..3800b359ef 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -2353,6 +2353,21 @@ NetworkOPsImp::recvValidation( pubValidation(val); + JLOG(m_journal.debug()) << [this, &val]() -> auto { + std::stringstream ss; + ss << "VALIDATION: " << val->render() << " master_key: "; + auto master = app_.validators().getTrustedKey(val->getSignerPublic()); + if (master) + { + ss << toBase58(TokenType::NodePublic, *master); + } + else + { + ss << "none"; + } + return ss.str(); + }(); + // We will always relay trusted validations; if configured, we will // also relay all untrusted validations. return app_.config().RELAY_UNTRUSTED_VALIDATIONS == 1 || val->isTrusted(); diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index daad520c77..e340105737 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -704,6 +704,7 @@ Consensus::peerProposal( NetClock::time_point const& now, PeerPosition_t const& newPeerPos) { + JLOG(j_.debug()) << "PROPOSAL " << newPeerPos.render(); auto const& peerID = newPeerPos.proposal().nodeID(); // Always need to store recent positions diff --git a/src/xrpld/consensus/ConsensusProposal.h b/src/xrpld/consensus/ConsensusProposal.h index c00bffe023..18dcf60006 100644 --- a/src/xrpld/consensus/ConsensusProposal.h +++ b/src/xrpld/consensus/ConsensusProposal.h @@ -26,6 +26,7 @@ #include #include #include +#include namespace ripple { /** Represents a proposed position taken during a round of consensus. @@ -194,6 +195,18 @@ public: proposeSeq_ = seqLeave; } + std::string + render() const + { + std::stringstream ss; + ss << "proposal: previous_ledger: " << previousLedger_ + << " proposal_seq: " << proposeSeq_ << " position: " << position_ + << " close_time: " << to_string(closeTime_) + << " now: " << to_string(time_) << " is_bow_out:" << isBowOut() + << " node_id: " << nodeID_; + return ss.str(); + } + //! Get JSON representation for debugging Json::Value getJson() const