diff --git a/src/cpp/ripple/LedgerConsensus.cpp b/src/cpp/ripple/LedgerConsensus.cpp index 971bb332a..23744cb1e 100644 --- a/src/cpp/ripple/LedgerConsensus.cpp +++ b/src/cpp/ripple/LedgerConsensus.cpp @@ -201,7 +201,7 @@ void LedgerConsensus::checkOurValidation() v->setTrusted(); v->sign(signingHash, mValPrivate); theApp->isNew(signingHash); - theApp->getValidations().addValidation(v); + theApp->getValidations().addValidation(v, "localMissing"); std::vector validation = v->getSigned(); ripple::TMValidation val; val.set_validation(&validation[0], validation.size()); @@ -1182,7 +1182,7 @@ void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer) v->sign(signingHash, mValPrivate); v->setTrusted(); theApp->isNew(signingHash); // suppress it if we receive it - theApp->getValidations().addValidation(v); + theApp->getValidations().addValidation(v, "local"); theApp->getOPs().setLastValidation(v); std::vector validation = v->getSigned(); ripple::TMValidation val; diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 26a8da1bf..f576fea8b 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -1164,10 +1164,10 @@ std::vector return accounts; } -bool NetworkOPs::recvValidation(SerializedValidation::ref val) +bool NetworkOPs::recvValidation(SerializedValidation::ref val, const std::string& source) { - cLog(lsDEBUG) << "recvValidation " << val->getLedgerHash(); - return theApp->getValidations().addValidation(val); + cLog(lsDEBUG) << "recvValidation " << val->getLedgerHash() << " from " << source; + return theApp->getValidations().addValidation(val, source); } Json::Value NetworkOPs::getConsensusInfo() diff --git a/src/cpp/ripple/NetworkOPs.h b/src/cpp/ripple/NetworkOPs.h index 99daf9483..00cb710c9 100644 --- a/src/cpp/ripple/NetworkOPs.h +++ b/src/cpp/ripple/NetworkOPs.h @@ -253,7 +253,7 @@ public: RippleAddress nodePublic, uint256 checkLedger, bool sigGood); SMAddNode gotTXData(const boost::shared_ptr& peer, const uint256& hash, const std::list& nodeIDs, const std::list< std::vector >& nodeData); - bool recvValidation(SerializedValidation::ref val); + bool recvValidation(SerializedValidation::ref val, const std::string& source); void takePosition(int seq, SHAMap::ref position); SHAMap::pointer getTXMap(const uint256& hash); bool hasTXSet(const boost::shared_ptr& peer, const uint256& set, ripple::TxSetStatus status); diff --git a/src/cpp/ripple/Peer.cpp b/src/cpp/ripple/Peer.cpp index 5f2629131..4a87a4dc4 100644 --- a/src/cpp/ripple/Peer.cpp +++ b/src/cpp/ripple/Peer.cpp @@ -1056,8 +1056,16 @@ static void checkValidation(Job&, SerializedValidation::pointer val, uint256 sig return; } + std::string source; + Peer::pointer lp = peer.lock(); + if (lp) + source = lp->getDisplayName(); + else + source = "unknown"; + std::set peers; - if (theApp->getOPs().recvValidation(val) && theApp->getSuppression().swapSet(signingHash, peers, SF_RELAYED)) + if (theApp->getOPs().recvValidation(val, source) && + theApp->getSuppression().swapSet(signingHash, peers, SF_RELAYED)) { PackedMessage::pointer message = boost::make_shared(*packet, ripple::mtVALIDATION); theApp->getConnectionPool().relayMessageBut(peers, message); diff --git a/src/cpp/ripple/ValidationCollection.cpp b/src/cpp/ripple/ValidationCollection.cpp index 2827c36f5..a9ffab3e1 100644 --- a/src/cpp/ripple/ValidationCollection.cpp +++ b/src/cpp/ripple/ValidationCollection.cpp @@ -34,7 +34,7 @@ VSpointer ValidationCollection::findSet(const uint256& ledgerHash) return mValidations.fetch(ledgerHash); } -bool ValidationCollection::addValidation(SerializedValidation::ref val) +bool ValidationCollection::addValidation(SerializedValidation::ref val, const std::string& source) { RippleAddress signer = val->getSignerPublic(); bool isCurrent = false; @@ -53,7 +53,7 @@ bool ValidationCollection::addValidation(SerializedValidation::ref val) else { cLog(lsDEBUG) << "Node " << signer.humanNodePublic() << " not in UNL st=" << val->getSignTime() << - ", hash=" << val->getLedgerHash() << ", shash=" << val->getSigningHash(); + ", hash=" << val->getLedgerHash() << ", shash=" << val->getSigningHash() << " src=" << source; } uint256 hash = val->getLedgerHash(); diff --git a/src/cpp/ripple/ValidationCollection.h b/src/cpp/ripple/ValidationCollection.h index 112e9c111..d73a546c6 100644 --- a/src/cpp/ripple/ValidationCollection.h +++ b/src/cpp/ripple/ValidationCollection.h @@ -37,7 +37,7 @@ public: ValidationCollection() : mValidations("Validations", 128, 600), mWriting(false) { mStaleValidations.reserve(512); } - bool addValidation(SerializedValidation::ref); + bool addValidation(SerializedValidation::ref, const std::string& source); ValidationSet getValidations(const uint256& ledger); void getValidationCount(const uint256& ledger, bool currentOnly, int& trusted, int& untrusted); void getValidationTypes(const uint256& ledger, int& full, int& partial);