fix: assert PeerReservationTable connection is initialized - #7724
fix: assert PeerReservationTable connection is initialized#7724BraedonKlock wants to merge 1 commit into
Conversation
|
Hi @BraedonKlock. Thank you for your contributions! We really appreciate them. At this point, we ask that you hold off on submitting any more until we've had a chance to review the current batch. There is a not insignificant engineer overhead for each review, and it may take some time to get caught up. Too many PRs can make that harder. When we've gotten down to 3 open or fewer, feel free to create more! In the meantime, you can open "Draft" PRs so that changes will be ready to go once we're ready for more. At that time, you'll be able to decide which ones are the best, and convert them to "Ready to review". Keep in mind that you will be responsible for keeping your PRs up to date with |
|
Thank you @ximinez for the clarification! I really appreciate the feedback. I completely understand. I'll hold off on opening additional ready for review PRs until my open count is down to three or fewer. In the meantime, I'll continue working locally and use draft PRs if appropriate. Thanks again! |
High Level Overview of Change
Adds defensive
XRPL_ASSERTchecks inPeerReservationTable::insertOrAssignandPeerReservationTable::eraseto ensureconnection_has been initialized before it is dereferenced.Fixes #7509.
Context of Change
PeerReservationTable::connection_is initialized tonullptrand is set duringPeerReservationTable::load(). The normal application startup path callsload()before these methods are reachable, butinsertOrAssign()anderase()previously dereferencedconnection_without guarding that initialization invariant.This change adds explicit assertions before calling
connection_->checkoutDb(), making the expected initialization order clear and preventing use-before-initialization from going unchecked.API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)