@@ -848,6 +848,46 @@ PeerImp::domain() const
848848
849849// Protocol logic
850850
851+ void
852+ logVLBlob (beast::Journal j, ValidatorBlobInfo const & blob, std::size_t count)
853+ {
854+ auto const stream = j.trace ();
855+ JLOG (stream) << " Blob " << count << " Signature: " << blob.signature ;
856+ JLOG (stream) << " Blob " << count << " blob: " << base64_decode (blob.blob );
857+ JLOG (stream) << " Blob " << count << " manifest: "
858+ << (blob.manifest ? base64_decode (*blob.manifest ) : " NONE" );
859+ }
860+
861+ void
862+ logVLBlob (
863+ beast::Journal j,
864+ std::pair<std::size_t , ValidatorBlobInfo> const & blob,
865+ std::size_t count)
866+ {
867+ logVLBlob (j, blob.second , count);
868+ }
869+
870+ template <class TBlobs >
871+ void
872+ logVL (
873+ beast::Journal j,
874+ std::string const & manifest,
875+ std::uint32_t version,
876+ TBlobs const & blobs,
877+ uint256 const & hash)
878+ {
879+ auto const stream = j.trace ();
880+ JLOG (stream) << " Manifest: " << manifest;
881+ JLOG (stream) << " Version: " << version;
882+ JLOG (stream) << " Hash: " << hash;
883+ std::size_t count = 1 ;
884+ for (auto const & blob : blobs)
885+ {
886+ logVLBlob (j, blob, count);
887+ ++count;
888+ }
889+ }
890+
851891void
852892PeerImp::doProtocolStart ()
853893{
@@ -2066,6 +2106,8 @@ PeerImp::onValidatorListMessage(
20662106 return ;
20672107 }
20682108
2109+ logVL (p_journal_, manifest, version, blobs, hash);
2110+
20692111 auto const applyResult = app_.validators ().applyListsAndBroadcast (
20702112 manifest,
20712113 version,
@@ -2108,7 +2150,8 @@ PeerImp::onValidatorListMessage(
21082150 " ripple::PeerImp::onValidatorListMessage : lower sequence" );
21092151 }
21102152#endif
2111- publisherListSequences_[pubKey] = applyResult.sequence ;
2153+ if (publisherListSequences_[pubKey] < applyResult.sequence )
2154+ publisherListSequences_[pubKey] = applyResult.sequence ;
21122155 }
21132156 break ;
21142157 case ListDisposition::same_sequence:
@@ -2127,8 +2170,37 @@ PeerImp::onValidatorListMessage(
21272170 }
21282171#endif // !NDEBUG
21292172
2173+ [[fallthrough]];
2174+ case ListDisposition::stale: {
2175+ auto const [pubKey, currentPeerSeq] = [&]() {
2176+ std::lock_guard<std::mutex> sl (recentLock_);
2177+ ASSERT (
2178+ applyResult.sequence && applyResult.publisherKey ,
2179+ " ripple::PeerImp::onValidatorListMessage : (stale) nonzero "
2180+ " sequence" );
2181+ auto const & pubKey = *applyResult.publisherKey ;
2182+ auto const & current = publisherListSequences_[pubKey];
2183+ ASSERT (
2184+ current <= applyResult.sequence ,
2185+ " ripple::PeerImp::onValidatorListMessage : (stale) valid "
2186+ " sequence" );
2187+ return std::make_pair (
2188+ pubKey, current ? current : applyResult.sequence );
2189+ }();
2190+ if (currentPeerSeq <= applyResult.sequence )
2191+ {
2192+ auto const [sentmanifest, sentversion, sentblobs, senthash] =
2193+ app_.validators ().sendLatestValidatorLists (
2194+ *this ,
2195+ currentPeerSeq,
2196+ pubKey,
2197+ app_.getHashRouter (),
2198+ p_journal_);
2199+ logVL (
2200+ p_journal_, sentmanifest, sentversion, sentblobs, senthash);
2201+ }
2202+ }
21302203 break ;
2131- case ListDisposition::stale:
21322204 case ListDisposition::untrusted:
21332205 case ListDisposition::invalid:
21342206 case ListDisposition::unsupported_version:
@@ -2219,7 +2291,7 @@ PeerImp::onValidatorListMessage(
22192291 break ;
22202292 case ListDisposition::stale:
22212293 JLOG (p_journal_.warn ())
2222- << " Ignored " << count << " stale " << messageType
2294+ << " Ignored " << count << " stale " << messageType
22232295 << " (s) from peer " << remote_address_;
22242296 break ;
22252297 case ListDisposition::untrusted:
@@ -2229,12 +2301,12 @@ PeerImp::onValidatorListMessage(
22292301 break ;
22302302 case ListDisposition::unsupported_version:
22312303 JLOG (p_journal_.warn ())
2232- << " Ignored " << count << " unsupported version "
2304+ << " Ignored " << count << " unsupported version "
22332305 << messageType << " (s) from peer " << remote_address_;
22342306 break ;
22352307 case ListDisposition::invalid:
22362308 JLOG (p_journal_.warn ())
2237- << " Ignored " << count << " invalid " << messageType
2309+ << " Ignored " << count << " invalid " << messageType
22382310 << " (s) from peer " << remote_address_;
22392311 break ;
22402312 default :
0 commit comments