Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
peers: Track errors across connections #4051
This PR adds tracking of peer errors across peer connections.
Suggestion: A boolean parameter can be added to the RPC
cfromknecht left a comment
Before adding those tho I think we need to decide whether this is meant to be for general debugging, or whether it should be reserved for in-protocol errors. imo i think the debugging tool is more useful so we can help node operators surface actionable errors.
@roeierez nice idea! Added this :)
I think debugging is also the primary use case here. Rather have more errors tracked and then potentially decrease what we track/ make cache size configurable etc.
For init, I'd say track invalid features and DLP required, pretty straightforward.
Disconnect is an interesting one, because I almost think you'd want to have the last disconnection reason around permanently, not have it in a buffer which may get over written after some number of errors. Maybe overkill, but it does seem to be a big debugging issue that people bring up so could be worth adding a dedicated last disconnection error field?
This commit introduces a fixed size circular buffer which stores elements in a fixed size underlying array, wrapping to overwrite items when the buffer gets full.
Add an error buffer to the peer struct which will store errors for peers that we have active channels with. We do not store these errors with peers that we do not have channels open with to prevent peers from connecting and costlessly spamming us with error messages. When the peer disconnects, the error buffer is offloaded to the server so that we can track errors across connections. When peers reconnect, they are created with their historic error buffer.