From c77216ea80f47af369c27fe8a18cfd2b88212a65 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sat, 5 Oct 2024 02:20:13 +0700 Subject: [PATCH] docs: explain meaning of MessageProcessingResult's members --- src/protocol.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/protocol.h b/src/protocol.h index 1ba1b8a5e2..a7913802ab 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -579,13 +579,32 @@ struct MisbehavingError {} }; +// TODO: replace usages of PeerMsgRet to MessageProcessingResult which is cover this one using PeerMsgRet = tl::expected; +/** + * This struct is a helper to return values from handlers that are processing + * network messages but implemented outside of net_processing.cpp, + * for example llmq's messages. + * + * These handlers do not supposed to know anything about PeerManager to avoid + * circular dependencies. + * + * See `PeerManagerImpl::PostProcessMessage` to see how each type of return code + * is processed. + */ struct MessageProcessingResult { + //! @m_error triggers Misbehaving error with score and optional message if not nullopt std::optional m_error; + + //! @m_inventory will relay this inventory to connected peers if not nullopt std::optional m_inventory; + + //! @m_transactions will relay transactions to peers which is ready to accept it (some peers does not accept transactions) std::vector m_transactions; + + //! @m_to_erase triggers EraseObjectRequest from PeerManager for this inventory if not nullopt std::optional m_to_erase; MessageProcessingResult() = default;