You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The relevant part of connection.rs is in handle_message_as_request, which is responsible for interpreting a Bitcoin message as a Request from a remote peer, then passing it to our inbound network service.
Ideally, this function should be handled as a single match statement, where each match arm is independent of the others and handles exactly one pattern. This can make the code superficially uglier, e.g.,
but makes the code easier to analyze and change (because the match arms are more independent of each other, and each one does one thing.
Currently there are three match statements in a row, with _ wildcard cases. Ideally they would be combined into one match statement, with no wildcard cases. Initially, this will probably require adding a bunch of patterns whose bodies are like
Message::Foo => {
tracing::debug!("unhandled message type Foo");None}
but it will be useful to enumerate all of the messages we need to be able to handle, rather than having a single catch-all "unhandled" arm.
based on a comment in code review
do we want to try to find a way to get exhaustive matching here?
Originally posted by @yaahc in #1016 (comment)
The text was updated successfully, but these errors were encountered: