From 2a73e11f51835d02254487869165aa49e1d49d5f Mon Sep 17 00:00:00 2001 From: Bart <11445373+bthomee@users.noreply.github.com> Date: Sat, 6 Jun 2026 17:52:00 -0400 Subject: [PATCH] fix: Always charge peer on strand --- src/xrpld/overlay/detail/PeerImp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 325f8ba038..44be4a2de2 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -392,8 +392,14 @@ PeerImp::removeTxQueue(uint256 const& hash) void PeerImp::charge(Resource::Charge const& fee, std::string const& context) { + if (!strand_.running_in_this_thread()) + { + post(strand_, [self = shared_from_this(), fee, context]() { self->charge(fee, context); }); + return; + } + if ((usage_.charge(fee, context) == Resource::Disposition::Drop) && - usage_.disconnect(pJournal_) && strand_.running_in_this_thread()) + usage_.disconnect(pJournal_)) { // Sever the connection overlay_.incPeerDisconnectCharges();